[REBOL] Re: func args by ladislav
From: lmecir:mbox:vol:cz at: 17-Oct-2001 23:19
> Hi, Ladislav,
> Now i've thinked a little about the 'do mistery.
> > 4) Can you write a Rebol function (a FUNCTION! datatype value) able to
> > evaluate any F (i.e. F with any number of arguments) without cheating,
> > without "packing" the arguments into a block?
> No. And RT also. I think that it is impossible to write a function which
> an unlimited number of arguments without a pointer to the line in which
> arguments can be found.
I am sorry that I succeeded to use a confusing terminology above. What I
really meant was to say, that even a one-argument taking function can "take"
an "unlimited" number of arguments, if your code "prepares" the arguments as
args: reduce [:arg1 :arg2]
You would probably agree, that in this case F (formally) takes only one
> 1) RT "cheats". In the sense that it gives to the function 'do an hidden
> which points to the executed line (the pointer used by the interpreter).
That would not be the same as above, because it still ensures, that DO can
take as many arguments as it needs.
> 2) In expressions like:
> do :- 1 2
> 'do sends to the interpreter a signal which say "evaluate the next value
> 'do arg) in a special mode", a sort of flag for the interpreter.
Because DO is native, the distinction simply depends on a decision which
code is considered a part of DO and which isn't.
> 3) Mecir can explain to me how to pass an unlimited number of arguments
> function without "cheating".
TOP SECRET :-)
> For what you know, the behaviour of 'do can be found in other fuctions
I think, that the MAKE function behaves similarly as DO, because the number
of arguments it takes depends on the arguments. The only difference is, that
the number is limited in the case of MAKE.