Jump to page: 1 2
Thread overview
gc heap
Nov 23, 2008
Sam S E
Nov 23, 2008
Sam S E
Nov 23, 2008
Sam S E
Nov 24, 2008
Sam S E
Nov 24, 2008
Sam S E
Nov 24, 2008
Sam S E
November 23, 2008
What is allocated in the gc heap? Just classes? Dynamic/associative arrays? Structs? Only things allocated with new? Do built-in types and structs get deallocated at the end of scope like in C?
November 23, 2008
On Sun, Nov 23, 2008 at 5:02 PM, Sam S E <asdf@mailinator.com> wrote:
> What is allocated in the gc heap? Just classes? Dynamic/associative arrays? Structs? Only things allocated with new? Do built-in types and structs get deallocated at the end of scope like in C?
>

Everything that is a reference type (classes, dynamic arrays, AAs) is
allocated on the heap.

Everything that is a value type (basic types, fixed-size arrays, structs) are allocated on the stack and are deallocated when the scope is left.

scope references to classes will delete the class they refer to when the scope is left.  As a special case, a declaration of the form "scope x = new ClassType()" will actually allocate the class instance on the stack instead of on the heap.
November 23, 2008
Jarrett Billingsley Wrote:

> On Sun, Nov 23, 2008 at 5:02 PM, Sam S E <asdf@mailinator.com> wrote:
> > What is allocated in the gc heap? Just classes? Dynamic/associative arrays? Structs? Only things allocated with new? Do built-in types and structs get deallocated at the end of scope like in C?
> >
> 
> Everything that is a reference type (classes, dynamic arrays, AAs) is
> allocated on the heap.
> 
> Everything that is a value type (basic types, fixed-size arrays, structs) are allocated on the stack and are deallocated when the scope is left.
> 
> scope references to classes will delete the class they refer to when the scope is left.  As a special case, a declaration of the form "scope x = new ClassType()" will actually allocate the class instance on the stack instead of on the heap.

Thank you; thanks to you I now have a basic understanding of all the features of D. Now if only Walter could implement all of them :)
--Sam
November 23, 2008
On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <asdf@mailinator.com> wrote:
>
> Thank you; thanks to you I now have a basic understanding of all the features of D. Now if only Walter could implement all of them :)
> --Sam
>

What's that supposed to mean?
November 23, 2008
Jarrett Billingsley Wrote:

> On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <asdf@mailinator.com> wrote:
> >
> > Thank you; thanks to you I now have a basic understanding of all the features of D. Now if only Walter could implement all of them :)
> > --Sam
> >
> 
> What's that supposed to mean?

There are many useful and interesting features that are planned but unimplemented.
November 23, 2008
On Sun, Nov 23, 2008 at 6:48 PM, Sam S E <asdf@mailinator.com> wrote:
> Jarrett Billingsley Wrote:
>
>> On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <asdf@mailinator.com> wrote:
>> >
>> > Thank you; thanks to you I now have a basic understanding of all the features of D. Now if only Walter could implement all of them :)
>> > --Sam
>> >
>>
>> What's that supposed to mean?
>
> There are many useful and interesting features that are planned but unimplemented.
>

...like what?
November 24, 2008
Jarrett Billingsley Wrote:

> On Sun, Nov 23, 2008 at 6:48 PM, Sam S E <asdf@mailinator.com> wrote:
> > Jarrett Billingsley Wrote:
> >
> >> On Sun, Nov 23, 2008 at 5:35 PM, Sam S E <asdf@mailinator.com> wrote:
> >> >
> >> > Thank you; thanks to you I now have a basic understanding of all the features of D. Now if only Walter could implement all of them :)
> >> > --Sam
> >> >
> >>
> >> What's that supposed to mean?
> >
> > There are many useful and interesting features that are planned but unimplemented.
> >
> 
> ...like what?

See http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf.
There are some amazing feature listed there. I can't think of anything else I'd like to see implemented (except for automatic type inference of substructs in struct literals).

I don't know how to explain those, so I'll give an example:

struct Foo
{
    int a;
    int b;
}

struct Bar
{
    Foo f;
    real asdf;
}

auto def = Bar(Foo(1, 42), 13.7);  //current
Bar def = {{1, 42}, 13.7};            //C-style
                                                 //downside: only possible if you initialize
                                                 //when you declare
auto def = Bar({1, 42}, 13.7);      //Bar for clarity, Foo obvious
                                        //simpler, especially with many nested structs

I've gotten pretty far off topic; this probably deserves it's own thread by now. --Sam
November 24, 2008
On Sun, Nov 23, 2008 at 10:59 PM, Sam S E <asdf@mailinator.com> wrote:
> See http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf.
> There are some amazing feature listed there. I can't think of anything else I'd like to see implemented (except for automatic type inference of substructs in struct literals).

Ah, OK.  Yeah, I wonder if a good number of those features will make it into D anytime soon.  Walter already said macros will be put off until D3, which were one of the major things I was looking forward to for D2..  in the mean time, a number of other ideas have come up and have taken precedence over many things mentioned in the slides.  Some are already implemented, though.

> I don't know how to explain those, so I'll give an example:
>
> struct Foo
> {
>    int a;
>    int b;
> }
>
> struct Bar
> {
>    Foo f;
>    real asdf;
> }
>
> auto def = Bar(Foo(1, 42), 13.7);  //current
> Bar def = {{1, 42}, 13.7};            //C-style
>                                                 //downside: only possible if you initialize
>                                                 //when you declare
> auto def = Bar({1, 42}, 13.7);      //Bar for clarity, Foo obvious
>                                        //simpler, especially with many nested structs

Better struct literals would be nice.
November 24, 2008
Jarrett Billingsley Wrote:

> On Sun, Nov 23, 2008 at 10:59 PM, Sam S E <asdf@mailinator.com> wrote:
> > See http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf.
> > There are some amazing feature listed there. I can't think of anything else I'd like to see implemented (except for automatic type inference of substructs in struct literals).
> 
> Ah, OK.  Yeah, I wonder if a good number of those features will make it into D anytime soon.  Walter already said macros will be put off until D3, which were one of the major things I was looking forward to for D2..  in the mean time, a number of other ideas have come up and have taken precedence over many things mentioned in the slides.  Some are already implemented, though.
> 
> > I don't know how to explain those, so I'll give an example:
> >
> > struct Foo
> > {
> >    int a;
> >    int b;
> > }
> >
> > struct Bar
> > {
> >    Foo f;
> >    real asdf;
> > }
> >
> > auto def = Bar(Foo(1, 42), 13.7);  //current
> > Bar def = {{1, 42}, 13.7};            //C-style
> >                                                 //downside: only possible if you initialize
> >                                                 //when you declare
> > auto def = Bar({1, 42}, 13.7);      //Bar for clarity, Foo obvious
> >                                        //simpler, especially with many nested structs
> 
> Better struct literals would be nice.

Better in what way? Do you like my syntax or do you have a better one?
November 24, 2008
On Mon, Nov 24, 2008 at 12:51 AM, Sam S E <asdf@mailinator.com> wrote:
> Better in what way? Do you like my syntax or do you have a better one?

Oh, I was agreeing with you, as well as implying that struct literals in general could be improved.
« First   ‹ Prev
1 2