Stable D version?

kenji hara k.hara.pg at gmail.com
Mon Apr 22 21:44:36 PDT 2013


2013/4/23 Mehrdad <wfunction at hotmail.com>

> On Monday, 22 April 2013 at 23:35:56 UTC, Flamaros wrote:
>
>> I started a project a month ago, and for the moment my feeling is just:
>> D can already be used as it.
>>
>
> Input:
>         import std.stdio;
>         struct S { string a; }
>         pragma(msg,           S("x") == S("x".idup));
>         void main() { writeln(S("x") == S("x".idup)); }
>
> Output:
>         true
>         false
>
> Nope, still broken.
>

This is mostly expected behavior. During compilation value identities are
not guaranteed.
Because compile time evaluation is always done after constant folding, and
constant folding would fold "x".idup to "x", then S("x") == S("x") is
evaluated to true.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130423/3b2e2b06/attachment.html>


More information about the Digitalmars-d mailing list