[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ preferences (was: RFC: lalr1.cc: support move semantics)
From: |
Akim Demaille |
Subject: |
Re: C++ preferences (was: RFC: lalr1.cc: support move semantics) |
Date: |
Thu, 13 Sep 2018 07:00:03 +0200 |
Hi!
> Le 12 sept. 2018 à 23:45, Frank Heckenbach <address@hidden> a écrit :
>
> Hi Akim!
>
>> So my favorite style is definitely
>>
>> const auto x = T{v};
>>
>> and I wish I could get rid of auto:
>>
>> const x = T{v};
>
> I do admit I usually don't declare my local variables const though
> they often should be
I recently had to work on some piece of software with coroutines,
and known what variables are immutable was really reassuring.
In my code I usually try to having the smallest possible scopes
for variables, more for readability than quick destruction, and
I now spread `const` for similar reason: help the reader.
> (because I also dislike overly long declarators
> that look like Java-style boilerplate, a la
> "public static final virtual override const volatile foo ()" ;).
Nice baby :)
> But if there was a more concise syntax, I'd like it. I had
> fantasized about a new keyword ("let") or a new syntax (":="),
Yep, I was impressed by Swift, there are many beautiful things
in this language. I really like their `let`.
> but
> if "const" with implied "auto" can simply work, that would be great.
> But we’re not designing C++ here, I know ...
I recently changed works, and have to deal with JavaScript.
They have const! But they also have let, and it means something
different…
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
- Re: RFC: lalr1.cc: support move semantics, (continued)
- Re: RFC: lalr1.cc: support move semantics, Frank Heckenbach, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Frank Heckenbach, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/12
- Re: RFC: lalr1.cc: support move semantics, Akim Demaille, 2018/09/13
- Re: RFC: lalr1.cc: support move semantics, Hans Åberg, 2018/09/13
- Re: RFC: lalr1.cc: support move semantics, Frank Heckenbach, 2018/09/13
- Re: RFC: lalr1.cc: support move semantics, Akim Demaille, 2018/09/13
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Frank Heckenbach, 2018/09/12
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics),
Akim Demaille <=
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences, Akim Demaille, 2018/09/13
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences, Akim Demaille, 2018/09/13
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences, Hans Åberg, 2018/09/13
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Frank Heckenbach, 2018/09/13
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Akim Demaille, 2018/09/15
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Frank Heckenbach, 2018/09/15
- Re: C++ preferences (was: RFC: lalr1.cc: support move semantics), Akim Demaille, 2018/09/15