On Wed, Nov 19, 2003 at 09:30:15AM -0700, Luke Palmer wrote: : Piers Cawley writes: : > All of which means you can wrap it up in a macro and prove Simon's : > point about what's syntax and what's CP6AN: : > : > macro unless_all( Block &test is parsed /<perl.expression>/, : > Block &consequence, [EMAIL PROTECTED] ) : > { my $guard = Object.new; : > for [EMAIL PROTECTED], $guard : > -> { when $guard { &consequence() ; last } : > when &test { last } } } : > : > But I've probably got the signature slightly wrong.
So far we've only allowed "is parsed" on the macro itself, not on individual arguments. Still, that's an interesting idea. : I think the only thing that's wrong with your signature is that you said : "macro" instead of "sub". Well, and &test has to be finessed into an : executable block somehow, but we're not supposed to know how yet. Hmm, how about statement:unless_all and modifier:unless_all? : > Higher Order Functions/Methods/Macros are great aren't they? : : What a modern thinker! Use a *function* to do a common task? *What* : are you talking about!? :-) Well, you mayn't put "is parsed" on a function. Macros have special rules to enforce lexical scoping of syntax munging, since the syntax must be known when the call is parsed. A function call can be parsed without such special knowledge. Larry