Date: Sat, 6 Jul 2019 16:28:13 +0100
On 06/07/2019 16:05, Arthur O'Dwyer wrote:
> On Sat, Jul 6, 2019 at 9:13 AM Jonny Grant via Std-Proposals
> <std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>> wrote:
>
> Hello
> My first post!
>
> *Parameter Names*
>
> Don't you just hate it when you're reading code that looks like
> this and no idea what those parameters are ?
>
> func(true, false);
>
> This is the function declaration - but it's a pain to go and find
> that:
> void func(bool debug, bool log);
>
> With this proposal, allowing inclusion of the parameter names
> makes it clear:
> func(debug=true, log=false);
>
>
> Well, that's not much of a "proposal" at this stage. ;)
> Think about what your proposal should do with
>
> void func(int debug, int log);
> int main() {
> bool debug = false;
> func(debug=true, log=false);
> }
Yes, assignment would no longer be possible. Maybe better to find
another way to write to that doesn't reuse =
I had thought to write as debug::true, buy maybe as per the proposal by
Axel Naumann a single colon is better, ie debug:true
http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0671r2.html
>
> And think about what your proposal should do with
>
> void func(int debug, int log); // overloaded
> void func(bool log2, bool debug2); // overloaded
> int main() {
> func(debug=true, log=false);
> }
Any exact match of the parameter names should take precedence? If they
can be implicitly converted. log=true is an exact match on the param
name, and can be implicitly converted.
Looks like this is an exact match of "debug" and "log" on void func(int
debug, int log); // overloaded
So looks like I am supporting Axel's proposal :)
cheers, Jonny
> On Sat, Jul 6, 2019 at 9:13 AM Jonny Grant via Std-Proposals
> <std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>> wrote:
>
> Hello
> My first post!
>
> *Parameter Names*
>
> Don't you just hate it when you're reading code that looks like
> this and no idea what those parameters are ?
>
> func(true, false);
>
> This is the function declaration - but it's a pain to go and find
> that:
> void func(bool debug, bool log);
>
> With this proposal, allowing inclusion of the parameter names
> makes it clear:
> func(debug=true, log=false);
>
>
> Well, that's not much of a "proposal" at this stage. ;)
> Think about what your proposal should do with
>
> void func(int debug, int log);
> int main() {
> bool debug = false;
> func(debug=true, log=false);
> }
Yes, assignment would no longer be possible. Maybe better to find
another way to write to that doesn't reuse =
I had thought to write as debug::true, buy maybe as per the proposal by
Axel Naumann a single colon is better, ie debug:true
http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0671r2.html
>
> And think about what your proposal should do with
>
> void func(int debug, int log); // overloaded
> void func(bool log2, bool debug2); // overloaded
> int main() {
> func(debug=true, log=false);
> }
Any exact match of the parameter names should take precedence? If they
can be implicitly converted. log=true is an exact match on the param
name, and can be implicitly converted.
Looks like this is an exact match of "debug" and "log" on void func(int
debug, int log); // overloaded
So looks like I am supporting Axel's proposal :)
cheers, Jonny
Received on 2019-07-06 10:30:09