D Lang'99 & Its future

Salih Dincer salihdb at hotmail.com
Wed Feb 9 16:20:32 UTC 2022


On Tuesday, 8 February 2022 at 18:28:21 UTC, H. S. Teoh wrote:
> On Tue, Feb 08, 2022 at 06:19:55PM +0000, Salih Dincer via 
> Digitalmars-d wrote:
>> Hope, D will go on to the next version,
>> the compiler will release up to v10!
>> 
>> Many happy returns of the (D)ay...🥳
>> 
>> ```d
>>   enum Dlang99 = 4026728633831507;
>> 
>>   union Magic
>>   {
>>     long data;
>>     char[8] bits;
>> 
>>     string toString()
>
> In latest dmd git HEAD, you need to annotate this function with 
> `return`, because it escapes a reference to `this`. :-)
>
>
>>     {
>>       return bits;
>>     }
>>   }
>>   auto magic = Magic(Dlang99<<10|'D');
>>        magic.writefln!"..::%s::..";
>> ```
>
>
> T

Okay, you're right. Now worked it: https://run.dlang.io/is/ja1n6C
```d
         auto toString()
         {
             return cast(string)bits;
         }
```


More information about the Digitalmars-d mailing list