[webkit-dev] [webkit-changes] [42699] trunk/WebCore
Geoffrey Garen
ggaren at apple.com
Tue Apr 21 12:50:28 PDT 2009
>> -EventListener* Node::getInlineEventListener(const AtomicString&
>> eventType) const
>> +EventListener* Node::getAttributeEventListener(const AtomicString&
>> eventType) const
>
> I think that per our coding style guidelines, this function should
> be named attributeEventListener():
>
> 6. Precede setters with the word "set". Use bare words for getters.
> Setter and getter names should match the names of the variables
> being set/gotten.
I see where you're coming from. I don't think this is a clear-cut case
if guideline #6, though.
getAttributeEventListener is not a getter for a variable -- it's a
lookup function for a family of variables, which takes a parameter
specifying what to look up. I'm concerned that naming it as if it were
a getter for a variable would be misleading.
We use the "get" prefix in other cases of lookup. For example, we have
*Hash*::get, ByteArray::get, Structure::get, JSValuePtr::get,
DOMObjectWrapperMap::get, getHashTableForGlobalData,
getCachedDOMObjectWrapper, getCachedDOMNodeWrapper,
getCachedDOMStructure, getCachedDOMConstructor, etc. I think this case
is more similar to those lookup functions than it is to a variable
getter.
Geoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090421/a44ea6d7/attachment.html>
More information about the webkit-dev
mailing list