January 22, 2008
Walter Bright wrote:
> Sean Kelly wrote:
>> Historically, this has been from additions to the TypeInfo objects.  Was there an increase in D 1.0 executable sizes as well?
> 
> It helps to use the right switches when compiling <g>.

Ah, there is that :-)
January 23, 2008
Walter Bright wrote:
> Extrawurst wrote:
>> ohh what a great day for const, #1319 was in top ten for me ;). thanks for this release!
>>
>> but what happened to scoped interfaces:
>> [CODE]
>>
>> interface IFoo {
>> }
>>
>> class Foo : IFoo {}
>>
>> IFoo getaFoo(){
>>    return new Foo();
>> }
>>
>> void main() {
>>    scope auto a = getaFoo();
>> }
>>
>> [/CODE]
>>
>> this is illegal since 2.010. how can i do such a thing from now on ?
> 
> It never worked anyway. The problem is an interface cannot be deleted. The solution is two steps:
> 
>   scope f = new Foo();
>   IFoo i = f;

Why can't an interface be deleted?  I'd think the compiler could simply cast the interface to Object and call _d_delclass on it.  Please note that the suggested workaround isn't always possible, as it's an entirely legitimate design strategy to have a function return an interface:

    interface I { void fn(); }
    class C : I { void fn() {} }
    class D : I { void fn() {} }

    I getAnI() { /* return new C or D */ }

    scope i = getAnI(); // shouldn't this be legal?

We currently do this in a number of places within Tango, and I'm delaying upgrading to DMD 1.026 for now because of this.  Worst case, we can change the code to something like:

    auto i = getAnI();
    scope(exit) delete cast(Object) i;

But this seems like a silly workaround for something that should work automatically.


Sean
January 23, 2008
Sean Kelly Wrote:
> Why can't an interface be deleted?
> We currently do this in a number of places within Tango, and I'm
> delaying upgrading to DMD 1.026 for now because of this.

This isn't specific to D 1.026.  It's an area of unstable behavior that's been in dmd for quite a while.  It bit me, and I submitted a bug report.  I interpret what happened in D 1.026 to be a temporary patch to help prevent others from hitting this type of issue.  It may help to post the functional cases from tango to the bug report to help Walter diagnose/fix the problem.
January 23, 2008
Jason House wrote:
> Sean Kelly Wrote:
>> Why can't an interface be deleted?
>> We currently do this in a number of places within Tango, and I'm
>> delaying upgrading to DMD 1.026 for now because of this.
> 
> This isn't specific to D 1.026.  It's an area of unstable behavior that's been in dmd for quite a while.  It bit me, and I submitted a bug report.  I interpret what happened in D 1.026 to be a temporary patch to help prevent others from hitting this type of issue.  It may help to post the functional cases from tango to the bug report to help Walter diagnose/fix the problem.

I know.  But it seems strange to me that the fix is to simply disallow the use of 'scope' with interfaces.  How are interfaces different from classes in this regard?  Why not just fix the codegen?


Sean
January 23, 2008
Sean Kelly wrote:
> Jason House wrote:
>> Sean Kelly Wrote:
>>> Why can't an interface be deleted?
>>> We currently do this in a number of places within Tango, and I'm
>>> delaying upgrading to DMD 1.026 for now because of this.
>> This isn't specific to D 1.026.  It's an area of unstable behavior that's been in dmd for quite a while.  It bit me, and I submitted a bug report.  I interpret what happened in D 1.026 to be a temporary patch to help prevent others from hitting this type of issue.  It may help to post the functional cases from tango to the bug report to help Walter diagnose/fix the problem.
> 
> I know.  But it seems strange to me that the fix is to simply disallow the use of 'scope' with interfaces.  How are interfaces different from classes in this regard?  Why not just fix the codegen?

Oh, as for the functional cases, they're just what I described.  A function returning an interface that doesn't need to escape the calling function.  In this instance, using 'scope' seems like a natural solution.


Sean
January 23, 2008
Sean Kelly schrieb:
>     interface I { void fn(); }
>     class C : I { void fn() {} }
>     class D : I { void fn() {} }
>
>     I getAnI() { /* return new C or D */ }
>
>     scope i = getAnI(); // shouldn't this be legal?
>   

Oh i beg to get this to work again, the workaround looks ridiculous to me.


~Stephan
January 24, 2008
Sean Kelly wrote:
> But this seems like a silly workaround for something that should work
> automatically.

I think you're right.
January 24, 2008
Sean Kelly wrote:

> Walter Bright wrote:
>> Extrawurst wrote:
>>> ohh what a great day for const, #1319 was in top ten for me ;). thanks for this release!
>>>
>>> but what happened to scoped interfaces:
>>> [CODE]
>>>
>>> interface IFoo {
>>> }
>>>
>>> class Foo : IFoo {}
>>>
>>> IFoo getaFoo(){
>>>    return new Foo();
>>> }
>>>
>>> void main() {
>>>    scope auto a = getaFoo();
>>> }
>>>
>>> [/CODE]
>>>
>>> this is illegal since 2.010. how can i do such a thing from now on ?
>> 
>> It never worked anyway. The problem is an interface cannot be deleted. The solution is two steps:
>> 
>>   scope f = new Foo();
>>   IFoo i = f;
> 
> Why can't an interface be deleted?  I'd think the compiler could simply cast the interface to Object and call _d_delclass on it.  Please note that the suggested workaround isn't always possible, as it's an entirely legitimate design strategy to have a function return an interface:
> 
>     interface I { void fn(); }
>     class C : I { void fn() {} }
>     class D : I { void fn() {} }
> 
>     I getAnI() { /* return new C or D */ }
> 
>     scope i = getAnI(); // shouldn't this be legal?
> 
> We currently do this in a number of places within Tango, and I'm delaying upgrading to DMD 1.026 for now because of this.  Worst case, we can change the code to something like:

Considering there is code in Tango that does not compile with 1.026 due to this, code that compiled and worked with previous versions, this is an obvious regression and breakage in the stable compiler branch.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
January 24, 2008
Walter Bright wrote:
> bug fixing
> 
> http://www.digitalmars.com/d/1.0/changelog.html
> http://ftp.digitalmars.com/dmd.1.026.zip
> 
> http://www.digitalmars.com/d/changelog.html
> http://ftp.digitalmars.com/dmd.2.010.zip

Keep up the good work, the bug fixes are much appreciated :)
January 24, 2008
Walter Bright wrote:
> bug fixing
> 
> http://www.digitalmars.com/d/1.0/changelog.html
> http://ftp.digitalmars.com/dmd.1.026.zip

The date for when 1.025 was released is wrong in the changelog now:

"Version D 1.025   Jan 21, 2008"

IIRC, it was released Jan 1.