Alternative syntax for <|

John J Barton johnjbarton at johnjbarton.com
Sat Nov 19 12:20:52 PST 2011


On Sat, Nov 19, 2011 at 11:07 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
>
> On Nov 17, 2011, at 2:05 PM, David Herman wrote:
>
>> On Nov 17, 2011, at 10:17 AM, Jason Orendorff wrote:
>>
>>> I'm with Allen. If ES classes can contain any initialization code, I
>>> think it should run in program order, interleaved with top-level
>>> statements. Anything else is just confusing.
>>
>> This is a great point, which I'd overlooked (not sure if Allen already said that and I missed it). But I'm not sure whether it argues for no declarative classes, for no syntax for statics, or for a restricted syntax for statics (e.g., only static methods).
>
> Not yet, but here goes.  If your hostable class definition contains any sort of evaluable initialization code then you have problems.  Such expression might include initializer for "static" properties but they also might include default value initializers for  instance properties.  Most importantly it includes the determination of the "super class".
>
> let base = oracle.whoIsTheBetterParent(phaseOfMoon);
> class sub1 extends base {...};
> class sub2 extends base { };
>
> or perhaps:
>
> class derived extends Flavors.mixin(nuts, heathbar, fudge) { ...}
>
> All of this is, of course subject, to your specific declaration class design.
>
> If you don't have and never intend to have any declaration components that are evaluated at runtime then hoist away.  But if this isn't the case you can't host classes.
>
> (BTW, obviously this isn't just about classes.  It applies to any binding form you might come up with in the future)

Allen, perhaps a number of issues discussed here on other threads
would be clearer if you explain this problem a bit more. You seem to
be saying "Don't compute base classes (BTW or anything else)" but I'm
unsure.

jjb


More information about the es-discuss mailing list