ES3.1 Object static methods rationale document
David Flanagan
david at davidflanagan.com
Wed Jul 16 13:41:38 PDT 2008
Brendan Eich wrote:
>
> Cool. I'm standing pat on describeProperty.
>
> /be
>
[I've removed es3.x-discuss, since I'm not a member]
The verb describe makes this sound like a setter method rather than a
getter method. That is, describeProperty sounds like a short name for
setPropertyDescriptor rather than getPropertyDescriptor.
Also, I think there is serious potential for confusion between
defineProperty and describeProperty. "Define" and "describe" both begin
with D and have similar meanings. Programmers are going to forget which
method is which.
Brendan, I think you were correct when you originally wrote:
> lookup : define :: get : put.
I think that lookupProperty is much nicer than describeProperty, since
"lookup" captures the getter nature of the method in a way that
"describe" does not.
Frankly, though, I imagine that defining properties will be more common
than reflecting on them, and I don't see anything wrong with a long name
that explicitly describes the function: getPropertyDescriptor(),
lookupPropertyAttributes() or whatever.
David Flanagan
More information about the Es4-discuss
mailing list