[e-lang] Call patterns

Kevin Reid kpreid at mac.com
Mon Jul 24 10:58:13 EDT 2006


On Jul 24, 2006, at 2:53, Dean Tribble wrote:

> I don't get it.
>
> It combines via -- which I still don't have an internal model for  
> -- with verb mangling into something that looks like it complicates  
> the semantics of message dispatch.  Is that the case?  Is there a  
> reason why that is not always a bad idea? :)

Call patterns are just more sugar, and do not affect dispatch. What  
they are useful for is matching all or most of the structure of  
complex objects without either introducing the additional complexity  
of quasi-patterns or explicitly naming each component.

   ? def functionArities(function) {
   >   var arity := 0..!0
   >   for makeMessageDesc(_, "run", params) \
   >       in function.__getAllegedType().getMessageTypes() {
   >     def messageArity := params.size()
   >     arity |= messageArity..messageArity
   >   }
   >   return arity
   > }
   # value: <functionArities>

   ? functionArities(escape e { e })
   # value: 0..!2

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




More information about the e-lang mailing list