January 24, 2011
On Sun, 23 Jan 2011 19:03:19 -0500, so <so@so.do> wrote:

> On Mon, 24 Jan 2011 00:11:48 +0200, Trass3r <un@known.com> wrote:
>
>> Sadly true.
>> They intend to replace it with a library based solution, I don't know why.
>
> If the library solution is as good as the original, it is a big plus.
> If only we could do the same for everything!

In fact the library solution will be better, because it's an expression, not a storage class.

This means, you can "scope" a class inside another statement instead of having to declare/initialize it separately.  It solves a bug I filed:

http://d.puremagic.com/issues/show_bug.cgi?id=2070

-Steve
January 24, 2011
On 1/24/11, Steven Schveighoffer <schveiguy@yahoo.com> wrote:
> This means, you can "scope" a class inside another statement instead of having to declare/initialize it separately.  It solves a bug I filed:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=2070
>
> -Steve
>

That is pretty cool. What I worried about is that a library solution could mean loosing help from the compiler itself. E.g. if the compiler sees a scoped variable it can do some checks to see that you're not escaping a reference by accident, inadvertently assigning it to a global, or some other sanity checks. I guess these things might be doable in a library but I don't know to what extent.
January 24, 2011
On Mon, 24 Jan 2011 09:41:30 -0500, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:

> On 1/24/11, Steven Schveighoffer <schveiguy@yahoo.com> wrote:
>> This means, you can "scope" a class inside another statement instead of
>> having to declare/initialize it separately.  It solves a bug I filed:
>>
>> http://d.puremagic.com/issues/show_bug.cgi?id=2070
>>
>> -Steve
>>
>
> That is pretty cool. What I worried about is that a library solution
> could mean loosing help from the compiler itself. E.g. if the compiler
> sees a scoped variable it can do some checks to see that you're not
> escaping a reference by accident, inadvertently assigning it to a
> global, or some other sanity checks. I guess these things might be
> doable in a library but I don't know to what extent.

That wasn't done by the compiler anyways.

-Steve
January 24, 2011
On 1/24/11, Steven Schveighoffer <schveiguy@yahoo.com> wrote:
> That wasn't done by the compiler anyways.
>
> -Steve
>

Yeah I've noticed that. Lazy DMD compiler! :)
January 24, 2011
On Monday 24 January 2011 07:49:44 Andrej Mitrovic wrote:
> On 1/24/11, Steven Schveighoffer <schveiguy@yahoo.com> wrote:
> > That wasn't done by the compiler anyways.
> > 
> > -Steve
> 
> Yeah I've noticed that. Lazy DMD compiler! :)

Much of anything that requires code flow analysis doesn't tend to happen. And it's so easy to get around it in many cases (such as passing a pointer to a function which then returns that pointer) that it wouldn't ultimately help all that much anyway (though having _some_ is still better than nothing). The fact that such things can't be reliably verified at compile time is exactly why scoped classes are unsafe in the first place.

- Jonathan M Davis
1 2
Next ›   Last »