[e-lang] Sugar for ad-hoc facet construction

Kevin Reid kpreid at mac.com
Tue May 15 18:19:02 EDT 2007


On May 15, 2007, at 17:21, David Hopwood wrote:

> Is the need for facet construction common enough to justify adding
> sytactic sugar to construct facets which may have two or more methods,
> e.g. timer.{now,every}?

The effect already exists: see org.erights.e.facet.makeStoneCast.

   ? def makeStoneCast := <import:org.erights.e.facet.makeStoneCast>
   # value: <makeStoneCast>

   ? def semiTimer := makeStoneCast(timer, interface _ {
   >     to now()
   >     to every()
   > })
   # value: makeStoneCast(<a Timer>, _)

   ? semiTimer.now()
   # value: 1179266937254

   ? semiTimer.whenPast(0, fn {})
   # problem: not allowed: whenPast/2

I would say that additional syntax is not worth increasing the  
complexity of the language, especially as we already have a usable  
form of reified message lists in the 'interface' syntax.

Verb-curry is different in that it is a simple derivation from call  
syntax, and has the additional feature of making facets which are  
functions (run/*), which is useful for adapting objects to interfaces  
accepting plain functions.

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




More information about the e-lang mailing list