Date: Wed, 12 Jun 2024 14:00:26 +0100
On Wed, 12 Jun 2024 at 13:01, Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Wed, Jun 12, 2024 at 10:50 AM Ivan Lazaric wrote:
> >
> > Const isn't just about not changing stuff (which can
> > also be broken out of with mutable but not important),
> > it gives you a different set of functionality, you get to
> > overload member functions on const qualifier, return
> > different types, which composes nicely with rest of
> > language. How would you achieve this with a 3rd party
> > tool?
>
>
> I meant:
>
> int main(void)
> {
> int /* never changes */ a = 7;
> a = 5;
> }
>
> But more to the point -- What I was getting at is that there are a lot
> of core language features that can be achieved by using a 3rd party
> code analysis tool.
>
> I'm very surprised that 'structured binding' made it into the
> language! I mean the following:
>
> auto& [a, b, c] = FuncReturnsTuple();
>
> could simply be:
>
> auto tup = FuncReturnsTuple();
> auto &a = std::get<0u>(tup);
> auto &b = std::get<1u>(tup);
> auto &c = std::get<2u>(tup);
>
Except it can't:
if (auto [a,b] = func(); a != 0) { }
for (auto [a,b] = funk(); a != 0; --a) { }
> 'Structured binding' is more of a disturbance to the core language
> than the stuff I'm suggesting here.
>
But it's more useful. The point is not that what you're proposing would be
hard to implement or specify, it's that it adds very little value.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
std-proposals_at_[hidden]> wrote:
> On Wed, Jun 12, 2024 at 10:50 AM Ivan Lazaric wrote:
> >
> > Const isn't just about not changing stuff (which can
> > also be broken out of with mutable but not important),
> > it gives you a different set of functionality, you get to
> > overload member functions on const qualifier, return
> > different types, which composes nicely with rest of
> > language. How would you achieve this with a 3rd party
> > tool?
>
>
> I meant:
>
> int main(void)
> {
> int /* never changes */ a = 7;
> a = 5;
> }
>
> But more to the point -- What I was getting at is that there are a lot
> of core language features that can be achieved by using a 3rd party
> code analysis tool.
>
> I'm very surprised that 'structured binding' made it into the
> language! I mean the following:
>
> auto& [a, b, c] = FuncReturnsTuple();
>
> could simply be:
>
> auto tup = FuncReturnsTuple();
> auto &a = std::get<0u>(tup);
> auto &b = std::get<1u>(tup);
> auto &c = std::get<2u>(tup);
>
Except it can't:
if (auto [a,b] = func(); a != 0) { }
for (auto [a,b] = funk(); a != 0; --a) { }
> 'Structured binding' is more of a disturbance to the core language
> than the stuff I'm suggesting here.
>
But it's more useful. The point is not that what you're proposing would be
hard to implement or specify, it's that it adds very little value.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2024-06-12 13:01:46