[Issue 7381] Make auto tail-const

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7381

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P2  |P4

--


[Issue 7381] Make auto tail-const

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7381

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|unspecified |D2

--


[Issue 7381] Make auto tail-const

2012-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7381


timon.g...@gmx.ch changed:

   What|Removed |Added

 CC||timon.g...@gmx.ch


--- Comment #1 from timon.g...@gmx.ch 2012-01-27 15:27:42 PST ---
It would make sense in a way, but how would generic code that preserves the
const-ness of some value be written nicely with this in place?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 7381] Make auto tail-const

2012-01-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7381



--- Comment #2 from Jonathan M Davis jmdavisp...@gmx.com 2012-01-27 15:37:11 
PST ---
Presumably, it would either use the generic type explicitly or use typeof. And
if it really wanted const, then it could just use const explicitly.

If the dropping of constness would make the assignment not possible though, I
would argue that the constness should be kept. So, then as long as the code
isn't in a situation where it doesn't need to keep constness but it _wants_ to,
auto works great. Whereas now, it's really easy to get into a situation where
you end up with a const or immutable variable when you really didn't want one,
just because the template was instatiated with a const or immutable type.

In general though, I think that if you want const or immutable, you use const
or immutable rather than auto. So, the fact that auto preserves full constness
causes far more problems than it would if it just preserved tail-constness.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---