Pseudotypes for compiler validation

Got an idea for enhancing SpiderBasic? New command(s) you'd like to see?
User avatar
eddy
Posts: 124
Joined: Thu Mar 27, 2014 8:34 am

Pseudotypes for compiler validation

Post by eddy »

I want to code a generic method like : MergeList(a(),b())
But there's no keywords (like Pseudotypes) to tweak the compiler argument validation

Pseudotypes-like syntax :

Code: Select all

Procedure.i Test(*a.p-Array, *b.p-Map, *c.p-List) : EndProcedure
other possible syntax :

Code: Select all

Procedure.i Test(*a-Array, *b-Map, *c-List) : EndProcedure

Code: Select all

Procedure.i Test(AsArray *a, AsMap *b, AsList *c) : EndProcedure
Usage:

Code: Select all

Procedure.i ConcatArray(*Array1.p-Array, *Array2.p-Array, *ResultArray.p-Array)  
EndProcedure

Dim a(1)
Dim b(1)
Dim c(0)
ConcatArray(a(),b(),c())
ConcatArray(a(),b(),foo) ;--> this will raise the exception "Bad parameter type : array is expected"