[e-lang] Overgeneralization: object+assignment syntax

Kevin Reid kpreid at attglobal.net
Sun Jul 23 10:51:54 EDT 2006


   def  x := y      def  x { to y ... }
   var  x := y      var  x { to y ... }
   bind x := y      bind x { to y ... }

Therefore:

        x := y           x { to y ... }

Expansion would be:
   x {}
->
   x := { def x {} }

At the moment, this looks like a bad idea, but it came to mind while  
writing some environment handling code with my slot-passing style  
(the node processor takes a var slot which it updates with the new  
environment):

           def check(node, &env) {
             ...
             node.welcome(def visitor {
               to visitFinalPattern(_, ne, ge) {
                 ...
                 env := def env2 extends env {
                   ...
                 }
                 ...
               }
               ...

With this syntax:

               to visitFinalPattern(_, ne, ge) {
                 ...
                 env extends env {
                   ...
                 }
                 ...
               }

Again, I don't seriously think this syntax should be included (and  
"<expr> { ... }" is probably more useful for something else); it is  
merely an Obvious Generalization.

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list