Steven Schveighoffer wrote:
type constructor. it has no meaning as a storage class since it's entirely transient (it only has any meaning inside functions).

I meant does it only apply at the top level, or does it apply down inside types?

BTW, I'm unsure if U[inout(T)] should work.

I just meant it as a compound type. It could as easily be:

    bar!(inout(T)) foo(inout X) { ... }

This is much more complex to implement than only allowing inout at the top level, i.e. as a storage class.
A storage class does not give you the transitivity that you need to enforce const rules. The inout tag must be carried forth to aliases of the same data.

I know, but I know how to make it work. There would be problems, though, ensuring that this works:

T[] foo(inout T[])
{
    return "hello";
}

What about this?

T[] foo(inout(U)[] p) {...}

Should the return type implicitly be inout(T)[] or inout T[] ?

It would have to be inout(T[])

Reply via email to