[REBOL] Re: func args by ladislav
From: rotenca:telvia:it at: 16-Oct-2001 19:52
Hi Joel,
> > Upto here, we agree. Functions have a fixed number of args. Right?
> >
>
> No, not AFAICT...
We are not speaking of any-type! args.
> Here's a function with a varying (within bounds) number of args...
>
> zzz: func [a [any-type!] b [any-type!]] [
Trace: zzz (word)
Trace: (end)
Trace: (end)
If you trace the execution of this function you will see that at every args is
assigned a fixed number of values of datatype end! which appears as unset!
value in the inner of function. The words 'a and 'b exist, are bound to the
function context and their value is unset.
>> zzz3: func [a [any-type!] b [any-type!] c [any-type!]] []
>> zzz3
Trace: zzz3 (word)
Trace: (end)
Trace: (end)
Trace: (end)
> Of course, this is not a completely unbounded number of arguments,
> but it is not absolutely fixed.
Is "fixed" in the sense of what Mecir say about 'do. Do can collect an
unlimited (undefined) number of arguments for Mecir. I can't imagine how can
exists in Rebol a function like 'do.
I think at a sort of in-line sostitution in case like:
do :+ 3 4
> -jn-
---
Ciao
Romano