[REBOL] Optional Arguments Working? Re:(9)

2000-06-22 Thread rsnell

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




[REBOL] Optional Arguments Working? Re:(9)

2000-06-22 Thread Galt_Barber





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

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

how about this?

print-val 1234 (print-val) print "DONE" print "WHAT?"

will that stop the greedy parser from grabbing the next item?