On Sun, Mar 04, 2007 at 09:25:31PM -0800, Jonathan Lang wrote:
: AFAICT, there's nothing in the documentation to explain how one would
: define a statement or operator with syntax along the lines of "if ...
: else ..." or "... ?? ... :: ..."  Admittedly, the only cases I know of
: where this is still an issue are the two listed above: for statements,
: all other perl 5 parallels have been replaced by the use of closure
: traits; and the operator listed above is the only more-than-binary
: operator that I've ever heard of which uses different delimiters.
: That said, for the sake of future customization, it would be nice to
: have a way to do these things.  (Or is this what macros are for?)
: 
: In the latter case, I find myself thinking about expanding on
: "infix:<>" to allow for a list of tokens, much like "circumfix:<>"
: does:
: 
:  infix:<?? ::> ($condition, $true, $false) #< $condition ?? $true :: $false 
:  >
: 
: ...and I'm wondering if something like this could be done in the
: former case as well:
: 
:  statement_control:<if else> ($condition, &true, &false?) #< if
: $condition { ... } else { ... } >
: 
: Although this wouldn't cleanly handle an "if ... elsif ... elsif ...
: else ..." statement.

Please see http://svn.pugscode.org/pugs/src/perl6/Perl-6.0.0-STD.pm for
the current definitions of those syntactic constructs.  The point of
doing grammars the way we're doing is to allow you to derive from this
grammar and override the rules as you see fit.  Macros and user-defined
are just convenient ways to define bits of grammar without actually
adding or modifying any rules, at least not overtly.

Larry

Reply via email to