[webkit-dev] On returning mutable pointers from const methods
Elliott Sprehn
esprehn at chromium.org
Thu Oct 25 20:53:49 PDT 2012
This requires weird contortions in the DOM and Render tree and removes
nice guarantees.
For example Node.h has:
TreeScope* treeScope() const;
Document* document() const;
Node* childNode(unsigned index) const;
Returning a const Document* or Node* from childNode makes the DOM
API's suddenly less useful, and marking them as non-const is
confusing. These methods shouldn't be making mutations and the
compiler should enforce that (or at least try to), and the const is also good
documentation.
On Thu, Oct 25, 2012 at 1:02 PM, Peter Kasting <pkasting at google.com> wrote:
> On Thu, Oct 25, 2012 at 3:48 AM, Andreas Kling <kling at webkit.org> wrote:
>>
>> So, I propose that we allow only these two signature formats for raw
>> pointers:
>>
>> - const Foo* foo() const;
>> - Foo* foo();
>
More information about the webkit-dev
mailing list