Austin Hastings: # Let's support separable verbs. # # Here's how: # # # Note my arbitrary selection of _ as separation indicator. # Feel free to replace this with something more appropriate: # # sub if ($test, &block) # _ elsif ($test, &block) is optional is floating is multi # _ elsunless ($test, &block) is optional is floating is multi # _ else (&block) is optional is fixed
How do you name one of these suckers? %::{'if'} #Incomplete, and is there an %::{'elsif'}? %::{'if_elsif_elsunless_else'} #Could conflict with other symbols %::{'if _ elsif _ elsunless _ else'} #Depends on ordering Remember, this also has bearing on importing them from a module. # { # while (!$args[0].test) shift; 1. Where did this $args come from? 2. The while syntax is way wrong. 3. How does else's test default to 1? # &args[0].block(); >From this, it's obvious you forgot about sigil invariance. # } # # Where: # # 1: I'm hacking real hard on the implementation. Better Ideas Welcome. # 2: space-underscore-space means "separable bit". Negotiable. BIW. # 3: is optional/[dflt: required] means doesn't have to appear. # 4: is floating/[dflt: fixed] means can appear in any order. # 5: is multi/[dflt: single] means can appear more than once. 5 conflicts with multimethods. # I think this is one of those p6-ish generalizations: # # try/catch/finally # do/while # if/elsif/elsunless/else # repeat/until # (arguably: switch/case/default) Except that none of the other ones exist in Perl 6. :^) try { ... CATCH { ... } } loop { ... last unless cond; } loop { ... last if cond; } given(topic) { when cond { ... } default { } } IMHO, separable keywords are in general a bad design, so perhaps they should be grammar-munge hard. We really don't need anything but else (and possibly its friends) for our purposes, but we want them everywhere, so I don't see why we shouldn't do it this way. --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen Configure) >How do you "test" this 'God' to "prove" it is who it says it is? "If you're God, you know exactly what it would take to convince me. Do that." --Marc Fleury on alt.atheism