[e-lang] Atomic expansion of MatchBindExpr to trinary-define

Mark S. Miller markm at cs.jhu.edu
Mon May 15 11:39:35 EDT 2006


Kevin Reid wrote:
> Is it truly necessary to provide left-to-right-define to support  
> this? Isn't (using the "into" syntax I just posted)
> 
>    (def a := 1) into ^(fail) ==a
> 
> equivalent to
> 
>    def specimen__1 := (def a := 1)
>    def ejector__2 := fail
>    def ==a := (specimen__1, ejector__2)
> 
> Not that we should actually perform this expansion, but that it is  
> possible to do the things we want without it.
> 
> That said, if we agree on a good syntax for left-to-right-define, I  
> would prefer to have it as the Kernel-E construct, and remove the  
> right-to-left trinary define syntax (e`def $a := ($b, $c)`) entirely.  
> I only want the reasons for its inclusion to be sound.


It took a while for the significance of the above observation to sink in.

After trying several candidate syntaxes for LTR define, I remained unhappy 
with all of them. I now realize that the problem isn't the particular 
syntaxes, it's the introduction of LTR define itself, under any syntax. The 
normal E programmer will continue to use RTL define, as above, since that is 
what's familiar from other languages. Introducing an LTR define into Kernel-E 
makes the language formally simpler but less familiar. It makes the overall E 
system seem more complex, because the expansion to Kernel-E now seems more 
different than the E program the programmer originally wrote.

Sorry for the backtracking, distraction, and confusion, but I now think we 
should go back to having the Kernel-E construct be LTR define. When expanding 
a match-bind-expression to Kernel-E, if there's a scope conflict, we can use 
Kevin's expansion above.

There remains the question of what should be the syntax of trinary define. I 
think the current LTR trinary define syntax is mysterious. On first 
encountering it, it gives no clue about the significance of the "extra" 
argument expression. I think I like Alan's suggested:

     "def" <pattern> "eject" <ejectorExpr> ":=" <specimenExpr>

-- 
Text by me above is hereby placed in the public domain

     Cheers,
     --MarkM




More information about the e-lang mailing list