IDEA: Use Unix-style chmod values for const and invariant

Janice Caron caron800 at googlemail.com
Fri Nov 30 01:56:54 PST 2007


On Nov 30, 2007 9:16 AM, Regan Heath <regan at netmail.co.nz> wrote:
> > Has anyone thought of using "in" for readonly view? Keywords don't
> > come much shorter. Its existing use is about as useful as unary plus.
>
> We already use it for function parameters...
>
> http://www.digitalmars.com/d/function.html
> "The in storage class is equivalent to final const scope"

And yet, this compiles and runs in D2.0

    int f(in int x)
    {
        ++x;
        return x;
    }

    void main()
    {
        int n = 42;
        int m = f(n);
    }

It doesn't seem to mean const to me. (Anyway, "final" has been ditched).



More information about the Digitalmars-d mailing list