[REBOL] Re: newbie question
From: greggirwin:mindspring at: 16-Mar-2004 14:21
Hi Greg,
BG> Wow! I actually had now clue you could do that....I was likening
BG> refinements to method calls....So even on user created functions you can
BG> 'chain' or 'pipeline' your refinements?
Yes, though they aren't really "pipelined" other than syntactically.
They can be given in any order, not just the order they are spec'd in
the function interface, and any arguments they take must be given in
the same order you specify the refinements.
>> fn: func [val /a aa /b bb][
[ print [val a aa b bb]
[ ]
>> fn 1
1 none none none none
>> fn/a 1
** Script Error: fn is missing its aa argument
** Near: fn/a 1
>> fn/a 1 2
1 true 2 none none
>> fn/b 1 2
1 none none true 2
>> fn/a/b 1 2 3
1 true 2 true 3
>> fn/b/a 1 2 3
1 true 3 true 2
BG> Any code examples to look at? (I guess maybe I can 'source' 'open ?
Nope; OPEN is a native.
-- Gregg