On 04/15/2016 05:27 PM, Steven Schveighoffer wrote:
On 4/15/16 5:01 PM, Andrei Alexandrescu wrote:
On 04/15/2016 04:45 PM, Steven Schveighoffer wrote:
On 4/15/16 4:34 PM, Andrei Alexandrescu wrote:
On 04/15/2016 04:16 PM, Steven Schveighoffer wrote:
If you find such advertisement useless, you of course do not need
inout
or const.
Let's not exaggerate by putting them together. -- Andrei
This is not an exaggeration.
Jesus. C++ has const without inout. We used to have const without inout
- and we probably should again. -- Andrei
"C++ has it" is a terrible argument.
You're losing track of the thread of the argument. It's not an argument,
it's the factual correct refutation of your wrong claim.
If you care about advertisement, you can't use templates to advertise
whether something is const or not. Your solution is "let's use templates
instead". That works, but obviously, compiler will let you molest
whatever data you want. Then advertisement is done with documentation
and trust.
C++ simply doesn't have that capability to advertise const for the
things inout can, but also const isn't as restrictive in C++, so you can
put const on things that aren't really const. IIRC Walter says C++ const
is useless for guarantees (and I agree with that).
Tell me what the benefits of const are. Pretty much all the arguments
you are saying for getting rid of inout (that don't involve corner cases
we can fix) can be used to say we should get rid of const too. Why stop
getting rid of complexity at inout?
The simple answer is const pays enough, inout doesn't.
Anyhow this meandering is the kiss of death - this exchange is becoming
a time-wasting back and forth, exactly the kind I promised myself to not
get involved in. I'll keep your good points in mind when deciding
whether we should rid D of inout.
Thanks,
Andrei