Jump to page: 1 2
Thread overview
[dmd-beta] D2 2.058 beta 3
Feb 12, 2012
Walter Bright
Feb 12, 2012
Mike Wey
Feb 12, 2012
Mike Wey
Feb 12, 2012
Walter Bright
Feb 12, 2012
Mike Wey
Feb 12, 2012
Walter Bright
Feb 12, 2012
Mike Wey
Feb 12, 2012
Andrej Mitrovic
Feb 12, 2012
Andrej Mitrovic
Feb 12, 2012
David Nadlinger
Feb 12, 2012
Andrej Mitrovic
Feb 12, 2012
Andrej Mitrovic
Feb 13, 2012
Leandro Lucarella
Feb 13, 2012
Martin Nowak
Feb 13, 2012
Mike Wey
February 12, 2012
http://ftp.digitalmars.com/dmd2beta.zip
February 12, 2012
On 02/12/2012 11:51 AM, Walter Bright wrote:
> http://ftp.digitalmars.com/dmd2beta.zip
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta

The attached file compiles with dmd 2.057 but fails with the beta.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.d
Type: text/x-dsrc
Size: 336 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120212/b842d6f1/attachment.d>
February 12, 2012
On 02/12/2012 02:50 PM, Mike Wey wrote:
> On 02/12/2012 11:51 AM, Walter Bright wrote:
>> http://ftp.digitalmars.com/dmd2beta.zip
>> _______________________________________________
>> dmd-beta mailing list
>> dmd-beta at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
> The attached file compiles with dmd 2.057 but fails with the beta.

Reduced the test case a little more.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.d
Type: text/x-dsrc
Size: 248 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120212/9a0d6290/attachment.d>
February 12, 2012

On 2/12/2012 5:59 AM, Mike Wey wrote:
> On 02/12/2012 02:50 PM, Mike Wey wrote:
>> On 02/12/2012 11:51 AM, Walter Bright wrote:
>>> http://ftp.digitalmars.com/dmd2beta.zip
>>> _______________________________________________
>>> dmd-beta mailing list
>>> dmd-beta at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>
>> The attached file compiles with dmd 2.057 but fails with the beta.
>
> Reduced the test case a little more.

What's happening is Object.opEquals(Object) needs to be called to do the comparison, meaning that Base must be converted to an Object. But the example only allows converting to a Base, hence it cannot call Object.opEquals(Object), hence the error message.

I think the code example is invalid.
February 12, 2012
On 02/12/2012 08:21 PM, Walter Bright wrote:
>
>
> On 2/12/2012 5:59 AM, Mike Wey wrote:
>> On 02/12/2012 02:50 PM, Mike Wey wrote:
>>> On 02/12/2012 11:51 AM, Walter Bright wrote:
>>>> http://ftp.digitalmars.com/dmd2beta.zip
>>>> _______________________________________________
>>>> dmd-beta mailing list
>>>> dmd-beta at puremagic.com
>>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>>
>>> The attached file compiles with dmd 2.057 but fails with the beta.
>>
>> Reduced the test case a little more.
>
> What's happening is Object.opEquals(Object) needs to be called to do the comparison, meaning that Base must be converted to an Object. But the example only allows converting to a Base, hence it cannot call Object.opEquals(Object), hence the error message.
>
> I think the code example is invalid.
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
But Base already is an Object, so why is it trying to call the opCast?

The unittest in my code that causes the error with the beta runs as expected when compiled with dmd 2.057.
February 12, 2012

On 2/12/2012 11:40 AM, Mike Wey wrote:
> On 02/12/2012 08:21 PM, Walter Bright wrote:
>>
>>
>> On 2/12/2012 5:59 AM, Mike Wey wrote:
>>> On 02/12/2012 02:50 PM, Mike Wey wrote:
>>>> On 02/12/2012 11:51 AM, Walter Bright wrote:
>>>>> http://ftp.digitalmars.com/dmd2beta.zip
>>>>> _______________________________________________
>>>>> dmd-beta mailing list
>>>>> dmd-beta at puremagic.com
>>>>> http://lists.puremagic.com/mailman/listinfo/dmd-beta
>>>>
>>>> The attached file compiles with dmd 2.057 but fails with the beta.
>>>
>>> Reduced the test case a little more.
>>
>> What's happening is Object.opEquals(Object) needs to be called to do the comparison, meaning that Base must be converted to an Object. But the example only allows converting to a Base, hence it cannot call Object.opEquals(Object), hence the error message.
>>
>> I think the code example is invalid.
>>
> But Base already is an Object, so why is it trying to call the opCast?

It's a Base, not an Object. It can be converted to an Object.

>
> The unittest in my code that causes the error with the beta runs as expected when compiled with dmd 2.057.
>

Right, it did not detect the invalid code before.
February 12, 2012
On 02/12/2012 09:08 PM, Walter Bright wrote:
>
> It's a Base, not an Object. It can be converted to an Object.

Doesn't that break Polymorphism?

You should be able to use Base as if it is an Object without a cast.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120212/cbba3d26/attachment.html>
February 12, 2012
Why does this not work anymore?

module test;

import std.algorithm;
import std.utf : count;

void main()
{
    "a".count();
}

test.d(8): Error: std.utf.count!(char).count at
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\utf.d(1757) conflicts
with std.algorithm.count!("true",string).count at
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(4551)

Selective imports used to make these conflicts go away. What changed?
February 12, 2012
I have a feeling I was relying on a compiler bug all this time.. I'm in a big pile of crap if that's the case.
February 12, 2012
On 2/12/12 10:58 PM, Andrej Mitrovic wrote:
> Why does this not work anymore?
>
> module test;
>
> import std.algorithm;
> import std.utf : count;
>
> void main()
> {
>      "a".count();
> }
>
> test.d(8): Error: std.utf.count!(char).count at
> D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\utf.d(1757) conflicts
> with std.algorithm.count!("true",string).count at
> D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(4551)
>
> Selective imports used to make these conflicts go away. What changed?

Personally, I certainly wouldn't expect selective imports to resolve conflicts, but what changed is that they were previously implemented using the equivalent of an explicit AliasDeclaration internally, which thus used to resolve the conflict.

David
« First   ‹ Prev
1 2