Thread overview | |||||
---|---|---|---|---|---|
|
January 11, 2012 Const lazy arguments? | ||||
---|---|---|---|---|
| ||||
I ask here first before submitting about this to Bugzilla. If lazy arguments can't be lvalues: void foo(lazy int x) { x = x; } void main() {} ==> test.d(2): Error: lazy variables cannot be lvalues What's the point of accepting const lazy arguments? void foo(const lazy int x) {} void main() {} Bye, bearophile |
January 11, 2012 Re: Const lazy arguments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | If you had a "const lazy SomeClass con" and a "lazy SomeClass mut", you could write "mut.x=y" but not "con.x=y". I think.
On 11/01/2012 04:46, bearophile wrote:
> I ask here first before submitting about this to Bugzilla.
>
> If lazy arguments can't be lvalues:
>
>
> void foo(lazy int x) {
> x = x;
> }
> void main() {}
>
> ==>
> test.d(2): Error: lazy variables cannot be lvalues
>
>
> What's the point of accepting const lazy arguments?
>
> void foo(const lazy int x) {}
> void main() {}
>
> Bye,
> bearophile
|
January 11, 2012 Re: Const lazy arguments? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Davis | Ben Davis:
> If you had a "const lazy SomeClass con" and a "lazy SomeClass mut", you could write "mut.x=y" but not "con.x=y". I think.
You are right, this code compiles:
struct Foo {
int i;
}
void foo(lazy Foo f) {
f.i++;
}
void main() {}
Thank you,
bearophile
|
Copyright © 1999-2021 by the D Language Foundation