--- Comment #7 from Steven Schveighoffer <> 2011-11-10 
12:38:04 PST ---
What it does is allow you to return data that is immutable, but is not part of
the input, and still have it be immutable after inout is resolved.

The example given isn't quite compelling, because the data is always being
created (even if hidden behind a secondary function).

However, this is a more solid use case:

immutable(int)[] n = [1,2,3];

inout(const(int))[] foo(inout(int)[] x){
    import std.random;
    bool condition = cast(bool)uniform(0,2);
    return condition ? x : n;

Without this, this cannot be an inout function.  It's signature would be:

const(int)[] foo(const(int)[] x)

Although this is legal, it loses specificity in the case where an immutable is
passed in.

I'm not saying it's not an enhancement or that the benefit is huge, but it's
definitely an improvement.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to