[Issue 12512] .dup of const structs does not work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 14 09:20:35 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12512

--- Comment #8 from monarchdodra at gmail.com ---
(In reply to Walter Bright from comment #7)
> (In reply to monarchdodra from comment #6)
> > Could we then allow "dup" to return "const(T)[]" for the cases where
> > it can't return a mutable then?
> 
> I suspect that would be considered surprising behavior.

I guess it depends on how you consider "dup" to operate. Arguably, it could
just be

"duplicates the array. Strips the qualifiers it can, for convenience".

Under such circumstance, it keeps its existing semantics, but is expanded to
support more types than before.

--


More information about the Digitalmars-d-bugs mailing list