ES3.1 Object static methods rationale document

Brendan Eich brendan at mozilla.org
Wed Jul 16 00:37:18 PDT 2008


On Jul 16, 2008, at 12:09 AM, Brendan Eich wrote:

> On Jul 15, 2008, at 11:50 PM, Brendan Eich wrote:
>
>> * getProperty and getProperties seem misnamed in light of common
>> usage of "get", "[[Get]]", "getProperty", etc. all connoting value-
>> getting, not descriptor-getting. getPropertyDescriptor is a bit
>> long, but not fatally so. Worth renaming?
>
> Shorter alternative verbs to "get": lookup, query. The analogy is
> lookup : define :: get : put.

That was unclear, sorry. I meant to suggest that "lookupProperty" is  
a shorter alternative to "getPropertyDescriptor". Using "lookup" or  
"query" relieves the need for "Descriptor" at the end to disambiguate  
value- from descriptor-getting. So:

// returns descriptor if (name in obj), else null or something falsy [1]
Object.lookupProperty(obj, name)

It's still longer than Object.getProperty, but Object.getProperty  
seems like a misnomer every time I read it, since it does not do a  
[[Get]] or [[GetProperty]]. ECMA-262 does not need more overloadings  
of "get-property" names.

Similar comments apply to Object.getOwnProperty.

/be

[1] The 15 July 2008 draft specifies false, not null, as the return  
value of Object.getProperty(O, P) when !(P in O) -- is this intended?



More information about the Es4-discuss mailing list