C++ Logo


Advanced search

Subject: Re: [std-proposals] Fixing some initialization gotchas
From: Maciej Cencora (m.cencora_at_[hidden])
Date: 2019-08-23 13:22:59

I think what Matthew was trying to say, that you can teach people one rule
how to use auto:
auto x = y;
That works as expected in all C++ version, and with my proposal, other auto
initialization syntaxes would just cause compiler error.

pt., 23 sie 2019 o 19:44 Hyman Rosen via Std-Proposals <
std-proposals_at_[hidden]> napisał(a):

> On Fri, Aug 23, 2019 at 12:44 PM Matthew Woehlke via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>> I can imagine *quite* easily how I would teach `auto a{1}`...
>> See? Easy!
> No, not easy at all. You cannot teach a language in which auto x = { 1 };
> is fine but auto x { 1 }; is a terrible error that nevertheless compiles
> and
> silently does something you don't want. When it comes time to write
> programs,
> no one is going to remember which is which. Having multiple constructs
> that
> appear to do something similar but have different behavior unapparent from
> the
> syntax is never going to be teachable.
> This is yet another example where C++ language designers are making
> terrible
> mistakes, most apparent in syntax of templates and lambdas. They seem to
> adhere
> to the notion that as long as they come up with an unambiguous syntax for
> a feature,
> their work is done. That is false. Good language design means that
> intent should be
> determinable from syntax, which in turn means that slight differences
> should not mean
> unrelated things.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

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

Standard Proposals Archives on Google Groups