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

Brendan Eich brendan at mozilla.org
Sun Apr 6 23:48:27 PDT 2008


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




More information about the Es4-discuss mailing list