From slices to perfect imitators: opByValue
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 8 03:35:28 PDT 2014
On 05/08/2014 12:14 PM, Michel Fortin wrote:
>
> Will this solve the problem that const(MyRange!(const T)) is a different
> type from const(MyRange!(T))?
No, but as stated it aggravates this problem.
> I doubt it. But they should be the same
> type if we want to follow the semantics of the language's slices, where
> const(const(T)[]) is the same as const(T[]).
>
> Perhaps this is an orthogonal issue, but I wonder whether a solution to
> the above problem could make opByValue unnecessary.
Not necessarily automatically, because there would still need to be a
way to figure out that actually const(S!T) -> S!(const(T)) is the way to
remove top-level constness. (Because sometimes it is actually
const(S!(T[])) -> S!(const(T)[]), for example, for most ranges in
std.algorithm.)
But I think the above problem is the fundamental one.
More information about the Digitalmars-d
mailing list