At the moment we can overgive an array to a procedure as a pointer to it's data:
Code: Select all
Dim Arrayname.l(202)
Procedure test(*arrData.l)
; some code with Peek/Poke or Structure-Pointers, etc...
EndProcedure
test(Arrayname()) ; or with a @
Code: Select all
Dim Arrayname.l(202)
Procedure test(myArr.l()) ; protected name for array, the type, and '()' as identifier for an array
myArr(2) + 1
; etc...
EndProcedure
test(Arrayname())
...2) same as 1) but for lists. So we could write e.g.:
Code: Select all
NewList myGlobalList.l()
Procedure test(list.l(LL)) ; protected name for list, type of it's elements, followed by e.g. '(LL)' as identifier for a list
ForEach list() ; etc...
Next
EndProcedure
test(myGlobalList())
..3) Overloading. Of course because of PB's auto-type-casting this could run into trouble. But if it would give e.g. (b) (w) (l) (s) (typename) prefix for signaling typecasting we could easily differ between (and use simultan in our code):
Code: Select all
Procedure.l test(p1.l, p2.l)
EndProcedure
Procedure.f test(p1.l, p2.f)
EndProcedure
Procedure.s test(p1.l, p2.s)
EndProcedure
Procedure.l test(p1.l, p2.s)
EndProcedure
...
debug (l) test(1234, 1234) ; calls the 1st - you might leave out the leading (l)
debug test(1234, (f) 1234) ; calls the 2nd
debug test(1234, "Peter") ; gives a 'overloading error: two possiblilities of return type'
debug (s) test(1234, "Peter") ; calls the 3rd
debug (l) test(1234, "Peter") ; calls the 4th
debug test(1234, (l) myVar) ; calls the 1st
...
Code: Select all
Structure AllType
StructureUnion
b.b
w.w
l.l
f.f
s.s
EndStructureUnion
typeflag.l
EndStructure
