Thread overview | |||||
---|---|---|---|---|---|
|
May 03, 2015 Parameter storage class 'in' transitive like 'const'? | ||||
---|---|---|---|---|
| ||||
We know that 'in' is "equivalent to const scope": http://dlang.org/function.html#parameters So, the constness of 'in' is transitive as well, right? Ali |
May 03, 2015 Re: Parameter storage class 'in' transitive like 'const'? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Sunday, 3 May 2015 at 05:20:34 UTC, Ali Çehreli wrote:
> We know that 'in' is "equivalent to const scope":
>
> http://dlang.org/function.html#parameters
>
> So, the constness of 'in' is transitive as well, right?
>
> Ali
Of course, there's no concept of non-transitive const in D:
struct S
{
char[] str;
}
void foo(in S s)
{
pragma(msg, typeof(s.str)); // const(char[])
}
|
May 03, 2015 Re: Parameter storage class 'in' transitive like 'const'? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Saturday, May 02, 2015 22:20:33 Ali Çehreli via Digitalmars-d-learn wrote:
> We know that 'in' is "equivalent to const scope":
>
> http://dlang.org/function.html#parameters
>
> So, the constness of 'in' is transitive as well, right?
Of course. in is identical to const scope. It doesn't introduce anything new. It's basically just an alias.
And I really wish that folks would stop using it, since it implies scope, and scope hasn't been properly implemented or even designed out yet...
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation