[webkit-dev] Do we have a style preference about const member functions?

Peter Kasting pkasting at google.com
Wed Jun 8 11:56:23 PDT 2011


On Wed, Jun 8, 2011 at 11:51 AM, Darin Adler <darin at apple.com> wrote:

> On Jun 8, 2011, at 11:48 AM, Peter Kasting wrote:
> > On Tue, Jun 7, 2011 at 11:18 PM, Maciej Stachowiak <mjs at apple.com>
> wrote:
> >> 1) We definitely have consensus to fix the broken non-logically-const
> accessors by making them non-const; consensus on also adding const accessors
> is less clear.
> >
> > There are a surprising number of places that actually do const
> traversals.  Simply making all these accessors non-const will require
> removing a lot of valid const usage from the existing code.  I'm really
> uncomfortable with that.
>
> I thought you did it already locally. You mentioned that you decided for
> many member functions that the right thing was to remove const. I suggested
> you land those changes first, before making the other changes.
>
> Are we talking about the same thing? Maybe you think Maciej is asking for
> something he’s not.


Maybe I got confused.  Some accessors cannot be const at all (IMO), like the
ones that update layout before returning the desired value.  Other
accessors, e.g. parentNode(), don't themselves do anything non-const and so
they could theoretically be valid as const and non-const versions.  What I
thought Maciej was saying was that we should remove "const" on all the
existing accessors, in both categories, which sounded different than what
you were saying (which I read as "remove const on the accessors in the first
category").

I'm perfectly happy removing "const" from accessors in the first category.
 I can post a change that does that before going any further.

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110608/d0d5acbb/attachment.html>


More information about the webkit-dev mailing list