> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Lars Hansen
> Sent: 7. april 2008 16:20
> To: [email protected]
> Subject: RE: ES4 draft: Object initializers
> 
> Here is the second draft, which incorporates most things 
> discussed so far.  Changelog near the beginning, with an OPEN 
> ISSUES section.

One facility that was introduced in this draft copies the
type tags of 'const' and 'var' attributed properties into
the type of the object, for "ease of use".  As a consequence,
this test is true:

  { const x: "foo" } is { x: string }

I am going to remove that facility again because it violates
the "explicit is better than implicit" principle.  IMO the
programmer should state her intent:

  { const x: "foo" } : { x: string }

Type definitions help make this somewhat less wordy.  And with
or without the type annotation x would still be a read-only
fixture, as desired, but the type of the x property would
be "*", not "string".

(It's easy to say that when the literals are simple then the
types are obvious, but once they involve more complicated
expressions I'm guessing the gains are illusory.)

--lars
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to