Named Parameters
Dar Scott
dsc at swcp.com
Fri May 4 22:57:51 EDT 2012
Sometimes I pass an array when there are many parameters, many will be missing in any particular call, or I expect the number to grow. Perhaps this will do what you want.
I suppose an alternative is to pass pairs of names and values in odd-even parameters.
You can also use globals and have the handler clear the globals afterward.
And you can pass comma pairs as parameters.
It has been a long time since I have used LISP.
Dar
On May 4, 2012, at 8:03 PM, Peter Haworth wrote:
> I seem to recall somewhere in the dim distant past that some languages have
> a syntax where function and procedure calls can have named parameters
> rather than positional ones.
>
> function doIT p1,p2,p3,p4,p5,p6,p7,p8,p9,p10
> ..
> ..
> end doIT
>
> put doIT("abc",p3="xyz", p10="def") into tVar
>
> When functions have a large number of possible parameters but not all of
> them are required, this is a great way to avoid having to count commas in
> the calls to them.
>
> I don;t think LC has any such syntax built in but wondering if anyone has
> tried to implement something similar?
>
>
> Pete
> lcSQL Software <http://www.lcsql.com>
More information about the use-livecode
mailing list