November 29, 2006 Idea for "scope" keyword | ||||
---|---|---|---|---|
| ||||
I thought it was very cool that .175 can instantiate an object on the stack using the scope keyword. Would it be possible to take this one step further and be able to use this approach on class fields so that they are not instantiated on the heap? I know you can use structs for this, but I find the limitations of D structs annoying. class A {}; class B { scope A a = new A; } -Craig |
November 29, 2006 Re: Idea for "scope" keyword | ||||
---|---|---|---|---|
| ||||
Posted in reply to Craig Black | Craig Black wrote:
> I thought it was very cool that .175 can instantiate an object on the stack using the scope keyword. Would it be possible to take this one step further and be able to use this approach on class fields so that they are not instantiated on the heap? I know you can use structs for this, but I find the limitations of D structs annoying.
>
> class A {};
>
> class B
> {
> scope A a = new A;
> }
I have a feeling this is where Walter is heading with the scope keyword, so it's probably just a matter of time.
Sean
|
Copyright © 1999-2021 by the D Language Foundation