You can already do that!Regenduft wrote:I would get a step futher and allow '$' as the part of a procedure names, if it's returning a Strings! But I guess this is not going to come.

You can already do that!Regenduft wrote:I would get a step futher and allow '$' as the part of a procedure names, if it's returning a Strings! But I guess this is not going to come.
Your suggestion is incorrect. The '$' doesn't become part of the name, if it did then 'Procedure$ MyProc()' would require you to use 'MyProc$()' when calling the procedure.MachineCode wrote:You can already do that!Regenduft wrote:I would get a step futher and allow '$' as the part of a procedure names, if it's returning a Strings! But I guess this is not going to come.Just use either "Procedure.s MyProc()" or "Procedure$ MyProc()".
I misunderstood what was being asked. My bad.Demivec wrote:Your suggestion is incorrect.
Hello Demivec,Demivec wrote: (...) it doesn't become part of the actual name of a variable (...)
Code: Select all
This.s = "Test"
debug This
Code: Select all
That$ = "Test"
debug That
NicknameFJHELP FILE wrote: Schreibweise von String-Variablen: es ist möglich, '$' als letztes Zeichen eines Variablennamens zu verwenden, um die Variable als String zu kennzeichnen. Auf diesem Weg können Sie 'a$' und 'a.s' als zwei unterschiedliche String-Variablen verwenden. Bitte beachten Sie, dass das '$' zum Variablennamen gehört und immer hinzugefügt werden muss, während das '.s' nur beim ersten Deklarieren der String-Variable benötigt wird.
@NicknameFJ: This was the reason for my request.NicknameFJ wrote:it is part of the variable name
This one will be removed in the next version.Demivec wrote:There are other quirks still lingering as well, one of these is allowing pointers to have a native type specified instead of a structure (i.e. *ptr.w, *ptr.s, or even *ptr$).
I'm glad to hear that. Thanks for the heads up.Fred wrote:This one will be removed in the next version.Demivec wrote:There are other quirks still lingering as well, one of these is allowing pointers to have a native type specified instead of a structure (i.e. *ptr.w, *ptr.s, or even *ptr$).
Hi Fred,Fred wrote:This one will be removed in the next version.Demivec wrote:There are other quirks still lingering as well, one of these is allowing pointers to have a native type specified instead of a structure (i.e. *ptr.w, *ptr.s, or even *ptr$).
Code: Select all
Prototype PtrNoInfo(*p) ;<-- OK but not helpful with documentation
Prototype PtrToNativeD(*p.d) ;<-- OK and helps identify parameter type
Prototype PtrToStrucDouble(*p.Double) ;<-- OK but much more to type and makes for really long lines :(
Procedure PtrNoInfo(*p)
PokeD(*p,2 * PeekD(*p))
EndProcedure
Procedure PtrToNativeD(*p.d)
PokeD(*p,2 * PeekD(*p))
EndProcedure
Procedure PtrToStrucDouble(*p.Double)
;PokeD(*p,2 * PeekD(*p))
*p\d * 2 ;<-- Alternative use
EndProcedure
Define.d x
Define *pp.PtrNoInfo = @PtrNoInfo()
Define *p.d = @x ;<-- OK, and less typing than *p.Double
;Define *p.Double = @x ;<-- OK
;Define *p.Byte = @x ;<-- Also works, but not helpful with documentation
Debug "-- Using PtrNoInfo(*p) --"
x = #PI
Debug "x = " + StrD(x,2)
PtrNoInfo(*p)
Debug "x = " + StrD(x,2)
Debug "-- Using PtrToNativeD(*p.d) --"
x = #PI
Debug "x = " + StrD(x,2)
PtrToNativeD(*p)
Debug "x = " + StrD(x,2)
Debug "-- Using PtrToStrucDouble(*p.Double) --"
x = #PI
Debug "x = " + StrD(x,2)
PtrToStrucDouble(*p)
Debug "x = " + StrD(x,2)
Debug "-- Using Prototype *pp.PtrNoInfo(*p) --"
x = #PI
Debug "x = " + StrD(x,2)
*pp(@x)
Debug "x = " + StrD(x,2)
Code: Select all
Procedure GetTitle$()
EndProcedure
Code: Select all
; FROM C
;;FN_ERROR _A_FUNC somedllfunction(FN_HANDLE handle,u32 nPts,f32 xdata[],f32 ydata[],f64 *res1,f64 *res2);
; TO PB
; 1 - preferred
PrototypeC.l somedllfunction(handle.l, nPts.i, *xdata.f, *ydata.f, *res1.d, *res2.d)
; 2
PrototypeC.l somedllfunction(handle.l, nPts.i, *xdata, *ydata, *res1, *res2)
; 3 -- Not sure if this one actually works for the *xdata pointing to an array of Float?
PrototypeC.l somedllfunction(handle.l, nPts.i, *xdata.Float,*ydata.Float,*res1.Double,*res2.Double)
Good point. Pointers qualified with unstructured native datatypes are meaningless and the fact that the compiler doesn't forbid them is a source of confusion, especially for someone trying to get a grip on the language. I'll be thrilled when Fred disallows them, I've always thought it should be done.I rely on AutoComplete to show me the various intended pointer data types and to not say it with dozens more characters.(
But what good do they do? Without a structure they are useless and a source of confusion because coders at earlier stages of learning will look at that and think it actually does something.*ptr.i,*ptr.l,*ptr.w,etc. are in no way a hindrance