Re: Dynamic class default (was Re: Class method addition...)

2008-04-07 Thread Brendan Eich
On Apr 6, 2008, at 8:10 PM, Kris Zyp wrote:

 Since you grant use-cases for sealing objects against mutation, are
 you simply arguing about what the default should be (that 'dynamic
 class' should not be required to get an extensible-instance factory,
 that 'class' should do that)?

 Well if it is up for debate... Can we have classes be dynamic by  
 default,
 and non-dynamic if the class is declared to be final?

'final' already means can't be overridden for methods and can't be  
extended by subclassing for classes in several languages. Adding  
another meaning, even if it's of the same mood, seems like a bad  
idea to me.

What's the point of your request? If you mean to promote AOP (a  
sacred cow, per my last message to you, reply-less :-P), you risk  
degrading overall integrity, or merely imposing a syntax tax as most  
class users have to say inextensible class (kidding, but it would  
have some contextual keyword in front -- and not static).

The default should match the common case as decided by programmers  
using classes because they want greater integrity than they get with  
closures. Even if a class's instances are extensible, it doesn't mean  
the fixed properties (fixtures) can be AOP'ed. It just means certain  
objects can be dressed up to resemble others, by some like relation  
-- for good or ill.

/be

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Dynamic class default (was Re: Class method addition...)

2008-04-07 Thread Kris Zyp

 'final' already means can't be overridden for methods and can't be
 extended by subclassing for classes in several languages. Adding  another 
 meaning, even if it's of the same mood, seems like a bad  idea to me.

 What's the point of your request? If you mean to promote AOP

I don't know what the connection would be.

 (a  sacred cow, per my last message to you, reply-less :-P)

I ran out of arguments :).

 , you risk  degrading overall integrity, or merely imposing a syntax tax 
 as most  class users have to say inextensible class (kidding, but it 
 would  have some contextual keyword in front -- and not static).

Just a idea for budget cuts, it's rejection doesn't bother me, not an 
important issue to me.
Kris 

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Dynamic class default (was Re: Class method addition...)

2008-04-07 Thread Steven Johnson
 Making classes dynamic by default is likely to make the
 verifier -- what we previously called strict mode --
 less effective, because a reference o.x cannot be flagged
 as an error unless o is known to be an instance of a
 sealed class that doesn't have an 'x'; if classes are
 sealed by default then more errors will likely be caught
 early.

Dynamic classes also incur nontrivial overhead in memory use and runtime
performance. IMHO we'd want a fairly compelling argument for making all
classes dynamic by default.

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Dynamic class default (was Re: Class method addition...)

2008-04-07 Thread Neil Mix

On Apr 7, 2008, at 10:37 AM, Steven Johnson wrote:
 Dynamic classes also incur nontrivial overhead in memory use and  
 runtime
 performance. IMHO we'd want a fairly compelling argument for making  
 all
 classes dynamic by default.

It would probably put an end to the acrimony about ES4 being too  
different from ES3; I'm hesitant to speak for the views of others, but  
I suspect this change would make the language a lot more palatable for  
many currently opposed to it.  In that light, compelling is going to  
be a highly subjective measurement.
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Dynamic class default (was Re: Class method addition...)

2008-04-07 Thread Steven Johnson
 It would probably put an end to the acrimony about ES4 being too
 different from ES3; I'm hesitant to speak for the views of others, but
 I suspect this change would make the language a lot more palatable for
 many currently opposed to it.  In that light, compelling is going to
 be a highly subjective measurement.

Since ES3 doesn't have true classes at all I'm not sure I entirely agree,
but I get your point in terms of the feel of the language.

Granted, putting an end to acrimony is a Good Thing and not to be ignored,
but somehow I don't see any magic bullet that possibly achieve that on its
own :-)

Let me put it another way: aside from changing the perceived feel of the
language, what specific use cases would be made better, faster, more secure,
more extensible, more reliable, etc. by such a change?

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


RE: Dynamic class default (was Re: Class method addition...)

2008-04-07 Thread Lars Hansen
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Lars Hansen
 Sent: 7. april 2008 10:25

 ... Kris is suggesting that classes should not be dynamic by
 default ...

Of course what Kris is suggesting that classes *should* be
dynamic by default.  The 'not' is misplaced, just ignore it.

--lars
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: Dynamic class default (was Re: Class method addition...)

2008-04-07 Thread Mark S. Miller
On Mon, Apr 7, 2008 at 10:45 AM, Neil Mix [EMAIL PROTECTED] wrote:

  On Apr 7, 2008, at 10:37 AM, Steven Johnson wrote:
   Dynamic classes also incur nontrivial overhead in memory use and
   runtime
   performance. IMHO we'd want a fairly compelling argument for making
   all
   classes dynamic by default.

  It would probably put an end to the acrimony about ES4 being too
  different from ES3; I'm hesitant to speak for the views of others, but
  I suspect this change would make the language a lot more palatable for
  many currently opposed to it.  In that light, compelling is going to
  be a highly subjective measurement.

Speaking as one of the more vocal skeptics, this change would make ES4
less palatable for me.

ES3.1 and ES4 are together moving in a good direction by making the
degree of permissiveness controllable on a per-property and per-object
basis. Subjectively, as someone interested in robustness, integrity,
and security, ES3 made a huge mistake in having all these be as
permissive as possible. Both ES3.1 and ES4, in order to be reasonably
compatible with ES3+R, must continue to have the ES3 constructs
default to overly permissive. For ES3.1 the best we can do is provide
explicit operations (such as __defineProperty__) for overriding these
defaults. To my mind, the main virtue of introducing a class syntax to
an ES is an opportunity to get these defaults right this time.

One principle of security engineering is deny by default is better
than allow by default; which is closely related to whitelisting is
better than blacklisting. For ES3.1, we're stuck with
allow-by-default. If the ES4 class syntax were to get this wrong as
well, I'd be even more puzzled about what its purpose is.

Accordingly, my preference is for classes to default to non-dynamic
and non-subclassable. For methods to default to non-overridable and
non-enumerable. And for properties/members to default to non-settable
and non-enumerable. Whatever these defaults are, it's an orthogonal
question whether classes need to be a primitive construct, or whether
they should be just sugar for a less-permissive-by-default usage of
the class-like abstraction pattern of ES3.1.

-- 
 Cheers,
 --MarkM
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: ES4 draft: Object initializers

2008-04-07 Thread Brendan Eich
var (outside of eval, an ES1 flaw) means DontDelete.

/be

On Apr 7, 2008, at 1:50 PM, Mark S. Miller wrote:

 On Mon, Apr 7, 2008 at 10:21 AM, Lars Hansen [EMAIL PROTECTED]  
 wrote:
  IMO it ought to be possible to use 'var' in those same ways but we
  didn't discuss that much (if at all).

 I don't understand. What would it mean?

 -- 
  Cheers,
  --MarkM
 ___
 Es4-discuss mailing list
 Es4-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es4-discuss

___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss


Re: ES4 draft: Object initializers

2008-04-07 Thread Mark S. Miller
On Mon, Apr 7, 2008 at 2:47 PM, Brendan Eich [EMAIL PROTECTED] wrote:
 var (outside of eval, an ES1 flaw) means DontDelete.

Excellent!

-- 
 Cheers,
 --MarkM
___
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss