C++ Logo


Advanced search

Subject: Re: [std-proposals] proposal: new const-able feature ( use "const?" , or new "constable" keyword) for method/function
From: jianping z (zjpwork_at_[hidden])
Date: 2019-12-13 19:00:34

good to know some others are also bothered with the "const" issue, and
try to find a way to solve this problem.

"deducing this" proposal is useful, if it is accepted, developer can use
it to inject additional methods to an existing class which developer is
not able to make change to its internal implementation.

in my opinion, it is useful, but it's not a good solution to "const" issue
1. it is awkward to use it to inject method to a self developed class
(which a developer can easily modify its source code)
2. it is not a suitable "const" solution, it is not straight forward,
and not intuitive to most developers, its only a workaround for "const"
3. it only work for a class, so it is C++ only, does not work for normal
function (C language).

my proposal works for class methods (C++ language), and normal function
(C language), and good for generic programming as well.

my proposal is not a workaround for "const" issue, it is an extension to
"const" keyword, so it is straight forward, and intuitive to developers
(to read/write code), and easy to implement too.

Best Regards,


On 12/13/2019 05:08 AM, Arvid Norberg wrote:
> On Fri, Dec 13, 2019 at 7:58 AM jianping z via Std-Proposals
> <std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>> wrote:
> Hi all,
> I have a proposal to add a const-able feature to the language in
> addition to "const" keyword. it can greatly reduce the duplicated
> code
> written for const and non-const method/function pair.
> It sounds like this has some overlap with "Deducing this":
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0847r2.html
> --
> Arvid Norberg

STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups