I'd like to propose a new use for the 'scope' keyword within an aggregate body.
Members of class type declared with the scope keyword are allocated not as
references or pointers, but initialized directly inside the container. Instead
of a default initializer of 'null', it will initialize with t
== Quote from John Simon (zildjoh...@gmail.com)'s article
> I'd like to propose a new use for the 'scope' keyword within an aggregate
> body.
> Members of class type declared with the scope keyword are allocated not as
references or pointers, but initialized directly inside the container. Instead
dsimcha wrote:
But the whole point of classes is that they're supposed to be polymorphic. If
you
don't need polymorphism, that's what structs are for. You can store them either
inline (default) or in separate heap space (using pointers). If you do need
polymorphism, you don't know at compile
Christopher Wright Wrote:
> dsimcha wrote:
> > But the whole point of classes is that they're supposed to be polymorphic.
> > If you
> > don't need polymorphism, that's what structs are for. You can store them
> > either
> > inline (default) or in separate heap space (using pointers). If you
John Simon wrote:
I'd like to propose a new use for the 'scope' keyword within an aggregate body.
Members of class type declared with the scope keyword are allocated not as
references or pointers, but initialized directly inside the container. Instead
of a default initializer of 'null', it wi
Sean Kelly wrote:
John Simon wrote:
I'd like to propose a new use for the 'scope' keyword within an
aggregate body.
Members of class type declared with the scope keyword are allocated
not as references or pointers, but initialized directly inside the
container. Instead of a default initiali
Sean Kelly wrote:
John Simon wrote:
I'd like to propose a new use for the 'scope' keyword within an
aggregate body.
Members of class type declared with the scope keyword are allocated
not as references or pointers, but initialized directly inside the
container. Instead of a default initiali
Andrei Alexandrescu wrote:
Sean Kelly wrote:
John Simon wrote:
I'd like to propose a new use for the 'scope' keyword within an
aggregate body.
Members of class type declared with the scope keyword are allocated
not as references or pointers, but initialized directly inside the
container. I
John Simon wrote:
You can always upcast and downcast safely, since it isn't actually a 'value'
type, only the address is passed around. The type of the class remains intact.
Right, but a scope variable has its type decided at compile time,
always. In that way, it's not polymorphic.
Sean Kelly wrote:
Andrei Alexandrescu wrote:
Sean Kelly wrote:
John Simon wrote:
I'd like to propose a new use for the 'scope' keyword within an
aggregate body.
Members of class type declared with the scope keyword are allocated
not as references or pointers, but initialized directly inside
Christopher Wright Wrote:
> John Simon wrote:
> > You can always upcast and downcast safely, since it isn't actually a
> > 'value' type, only the address is passed around. The type of the class
> > remains intact.
>
> Right, but a scope variable has its type decided at compile time,
> always.
Sean Kelly Wrote:
> Sean Kelly wrote:
> > John Simon wrote:
> >> I'd like to propose a new use for the 'scope' keyword within an
> >> aggregate body.
> >>
> >> Members of class type declared with the scope keyword are allocated
> >> not as references or pointers, but initialized directly inside
John Simon wrote:
Sean Kelly Wrote:
Oh, I should mention that I'm not sure how the compiler would handle
this scenario:
class A { byte[16]; }
class B { byte[32]; }
class C {
this( bool b ) {
if( b ) o = new A;
elseo = new B;
}
scope Object o;
}
If I had
Christopher Wright wrote:
Sean Kelly wrote:
Andrei Alexandrescu wrote:
Sean Kelly wrote:
John Simon wrote:
I'd like to propose a new use for the 'scope' keyword within an
aggregate body.
Members of class type declared with the scope keyword are allocated
not as references or pointers, but
Sean Kelly Wrote:
> John Simon wrote:
> > Sean Kelly Wrote:
> >>
> >> Oh, I should mention that I'm not sure how the compiler would handle
> >> this scenario:
> >>
> >> class A { byte[16]; }
> >> class B { byte[32]; }
> >> class C {
> >> this( bool b ) {
> >> if( b ) o = new A;
> >>
John Simon wrote:
Sean Kelly Wrote:
John Simon wrote:
Sean Kelly Wrote:
Oh, I should mention that I'm not sure how the compiler would handle
this scenario:
class A { byte[16]; }
class B { byte[32]; }
class C {
this( bool b ) {
if( b ) o = new A;
elseo = new B;
On Mon, Mar 9, 2009 at 7:12 AM, John Simon wrote:
> Sean Kelly Wrote:
>
>> John Simon wrote:
>> > Sean Kelly Wrote:
>> >>
>> >> Oh, I should mention that I'm not sure how the compiler would handle
>> >> this scenario:
>> >>
>> >> class A { byte[16]; }
>> >> class B { byte[32]; }
>> >> class C {
>>
Bill Baxter wrote:
On Mon, Mar 9, 2009 at 7:12 AM, John Simon wrote:
Sean Kelly Wrote:
John Simon wrote:
Sean Kelly Wrote:
Oh, I should mention that I'm not sure how the compiler would handle
this scenario:
class A { byte[16]; }
class B { byte[32]; }
class C {
this( bool b ) {
Sun, 08 Mar 2009 16:06:56 -0700, Andrei Alexandrescu wrote:
> Bill Baxter wrote:
>> On Mon, Mar 9, 2009 at 7:12 AM, John Simon wrote:
>>> Sean Kelly Wrote:
>>>
John Simon wrote:
> Sean Kelly Wrote:
>> Oh, I should mention that I'm not sure how the compiler would handle
>> this sc
On 09/03/2009 00:12, John Simon wrote:
Sean Kelly Wrote:
John Simon wrote:
Sean Kelly Wrote:
Oh, I should mention that I'm not sure how the compiler would
handle this scenario:
class A { byte[16]; } class B { byte[32]; } class C { this(
bool b ) { if( b ) o = new A; elseo = new B; } scop
On Sat, 07 Mar 2009 08:15:59 +0300, John Simon wrote:
I'd like to propose a new use for the 'scope' keyword within an
aggregate body.
Members of class type declared with the scope keyword are allocated not
as references or pointers, but initialized directly inside the
container. Instead
Yigal Chripun Wrote:
> On 09/03/2009 00:12, John Simon wrote:
> > Sean Kelly Wrote:
> >
> >> John Simon wrote:
> >>> Sean Kelly Wrote:
> Oh, I should mention that I'm not sure how the compiler would
> handle this scenario:
>
> class A { byte[16]; } class B { byte[32]; } class C
Denis Koroskin Wrote:
> On Sat, 07 Mar 2009 08:15:59 +0300, John Simon wrote:
>
> > I'd like to propose a new use for the 'scope' keyword within an
> > aggregate body.
> >
> > Members of class type declared with the scope keyword are allocated not
> > as references or pointers, but initializ
John Simon wrote:
Oh man I've tried, believe me.
I couldn't figure out how to call the destructors in-place. Also, structs can't
have parameter-less constructors
Have you tried just calling delete on the reference? That should do
what you want. In D2 it certainly will at any rate... I have
Sean Kelly Wrote:
> John Simon wrote:
> >
> > Oh man I've tried, believe me.
> > I couldn't figure out how to call the destructors in-place. Also, structs
> > can't have parameter-less constructors
>
> Have you tried just calling delete on the reference? That should do
> what you want. In D2
25 matches
Mail list logo