C++ Logo

std-proposals

Advanced search

Re: DRAFT: Abbreviated Arguments Part 1

From: Михаил Найденов <mihailnajdenov_at_[hidden]>
Date: Sat, 19 Jun 2021 20:15:08 +0300
Thanks for the feedback.
I have updated the proposal and it is now complete. I am also attaching a
pdf version for easier viewing.

Thank You!

On Sun, Jun 13, 2021 at 7:31 PM Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> meaning
>
> On Sun, Jun 13, 2021 at 8:17 AM Михаил Найденов via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > Any objections and/or comments, pursuing this (for 23)? Thank You
>
> It's kind of hard to read, as it's an HTML document on OneDrive being
> rendered as... plain text. So to read it, you basically have to
> download it.
>
> After downloading, I have some commentary:
>
> > Abbreviated Arguments Part 1
>
> You're using the words the wrong way. You consistently do it, but it's
> consistently wrong, right down to the title: "Argument" refers to the
> expression used to initialize a function's "parameters". What you're
> declaring in a function declaration are *parameters*, not "arguments".
>
> > Introduce a slightly different syntax to donate Abbreviated Arguments:
>
> "denote", not "donate".
>
> > The above declaration is equivalent to:
>
> ```
> template<class T>
> auto something(T <qualifiers> string, const vector& v);
> ```
>
> > Function template. <qualifiers> are discussed in Part 2.
>
> Well, without "Part 2" in hand, how can we evaluate the meaning of
> "Part 1"? How meaningful it is depends *entirely* on how those
> qualifiers are generated.
>
> Remember: the whole point of this proposal is to make function
> prototypes shorter where needed. But "needed" depends entirely on how
> you generate qualifiers. To use your example:
>
> ```
> [](const auto& fruit, const auto& basket) { return fruit + ": " +
> std::to_string(basket.size());
> // to (this proposal)
> []((fruit, basket)) { return fruit + ": " +
> std::to_string(basket.size());
> ```
>
> OK, so you've decided that `fruit` is an `auto const&`. So... what do
> I do if I want to modify it? Or if I want to forward it? Do I have to
> go back to `auto`, or can I just say `&&fruit`? And if I can... how
> helpful is that compared to just using `auto &&`?
>
> Remember: the principle use case is short lambdas. And I would argue
> that short lambdas are the ones *most likely* to want to forward their
> parameters. So the argument could be made that you're not making that
> code appreciably shorter.
>
> But I don't know if that's true since you never actually say how this
> gets figured out. Until you do, it's just half a proposal. And we
> can't evaluate half of a proposal.
>
> > This is ignoring the fact, `auto&&` is somewhat of a geek, "too clever"
> option in my opinion.
>
> It's not. C++ programmers need to get used to seeing and using it.
> Especially in template code where you'll be doing a lot of forwarding
> or in range-based `for` loops that want to work with proxy iterators.
> See this for more:
>
> https://stackoverflow.com/questions/51461281/range-ts-idioms-and-the-mysterious-auto
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2021-06-19 12:15:26