Ah, I finally get it.  I was letting whitespace confuse me.

Basically, I think I'll stay away from default arguments
from now on.

Thanks for all the help!

Rodney


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 22, 2000 12:31 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] Optional Arguments Working? Re:(8)



Hi Rodney,

note that you can do this to prevent your argument from being executed:

print-val: func ['val [any-type!]] [ 
  print either unset? get/any 'val ["No value given"] [get 'val]
]

Here's the result of running your code:

>> print-val 1234 print-val print "DONE" print "WHAT?"

1234
print
WHAT?


REBOL can't know whether 'print is an argument to 'print-val or not.
To do that, it would have to tell data from code.
You wouldn't want that would you? ;)

Gisle

Reply via email to