You must perform your test in a script file and
'do it to see the bug.  The bug does not occur
in a console session.

Rodney

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 21, 2000 9:17 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] Optional Arguments Working? Re:(4)


Larry wrote:
> REBOL []
>
> print {
>  Bug in optional args called from script.
>  If  123 is removed from the 6th call to f,
>  f is not called at all.
> }
>
> f: func [a [any-type!]][print "f got called"]
>
> f
> f
> f
> f
> f
> f 123
> halt

Actually, there is no bug. Here's a console session:

>> f: func [a [any-type!]][print "f got called"]
>> f
f got called
>> f f f f f f 123 halt
f got called
f got called
f got called
f got called
f got called
f got called
>> f f f f f f 123
f got called
f got called
f got called
f got called
f got called
f got called
>> f f f f f f halt
>>

Note that Rebol evaluates the arguements to a function before calling the
function. In this case:
        f f f f f f halt
    the 'halt is evaluated just before evaluating the last (or first in
reverse order) 'f function. 'halt has the side effect of stopping execution
of Rebol, so the last 'f is not evaluated.

I hope that helps!

Andrew Martin
Infinitely nested Rebol...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-

Reply via email to