Wiki re-export

Brendan Eich brendan at mozilla.org
Wed Mar 14 23:46:46 PDT 2007


On Mar 14, 2007, at 6:50 PM, liorean wrote:

> In Chapter 6, I would like more detail on the type operator. For
> example, does this work?
>
>    type N={
>        left:(N,Null),
>        right:(N,Null),
>        value:*};
>
> In other words, could I define recursive data structures like that?

No, we restrict structural types to be non-recursive. Recursive  
structural subtype checking is exponential with the simpler original  
(due to Cardelli et al.) algorithm, or quadratic with a quite-complex  
more recent algorithm, and we don't believe the costs (to  
implementors, and possibly high hidden runtime costs for users) are  
worth it.

> If
> not, is some other way of defining recursive data structures
> available?

Use nominal types.

/be



More information about the Es4-discuss mailing list