--- Brent Dax <[EMAIL PROTECTED]> wrote: > 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. >
Full name, with full signature. if_elsif_elsunless_else($c,&b,$c,&b, $c, &b, &b); Maybe a special widget in the arglist to denote separability? This could be important for varargs multimethods. > # { > # 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. I can't even spell sigil invariance. And I'm nowhere close to sure that it would be valid to use "while" when in the middle of trying to define "if". I was "backfilling" the innards after writing the 'outards'. Just a competence fault on my part. > > # } > # > # 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. s/multi/repeatable/ or whatever. BIW. > > # 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. :^) Because we have not heretofore had a cool syntax for separable verbs. Now we do. Now it can be possible to say "use pascal;" and get extra syntax overhead. Rejoice. :-/ > > 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. Go us. One step closer to total world domination. =Austin