> Funny you should mention that.  This brings up something that I was
> afraid to mention before, lest it be regarded as too weird.  There isn't
> any strong syntactic reason for subs to be delimited with just braces either.[*]
> Sure, there's a historical Perl precedent, and I'd probably be forced to
> put the C<sub> keyword in there, but imagine a Perl that could handle
> this:
> 
>   sub foo «
>     mumble
>   »
>
> I'm imagining a table something like this:
> 
>                  Subroutine                 Pattern matching
> --------------------------------------------------------------------
> 
> Default          { code }                   / pattern /
> delimiter 
> 
> Declare named    sub foo <delim>            rule foo <delim>
>                     code                      pattern
>                  <delim>                    <delim>
> 
> Declare named    sub foo (args) <delim>     rule foo (args) <delim>
> with args           code                      pattern
>                  <delim>                    <delim>
> 
> Create           $ref = sub <delim>         $ref = rule <delim>
> anonymous          code                       pattern
>                  <delim>                    <delim>
> 
> Create           $ref = sub (args) <delim>  $ref = rule (args) <delim>
> anonymous with     code                       pattern          
> args             <delim>                    <delim>            
> 
> 
> (By "default delimiter" I mean the delimiter that allows you to create
> an anonymous thingy without using "sub" or "rule".)

You're right, it is very weird.  But to be honest, there's something 
downright appealing about it.  For what it's proposing, it gives a strange 
sense of consistency and unification.

I suppose it would be trivial to modify the grammar to do this.  If it 
were included in the language (yeah, right), it would probably be best not 
to tell newcomers about it.  It would scare a lot of the hardcore 
other-language programmers off for sure.

Of course, it's vastly diverging from Larry's "{} means a closure." It's 
not breaking the rule, it's just going far, far away from it.

In general, I doubt this will make it past the "that would be cool" stage, 
that is until we find out how to rewrite the grammar :).

Luke

Reply via email to