Growing a Language (applicable to @attribute design)

Era Scarecrow rtcvb32 at yahoo.com
Thu Nov 15 11:32:29 PST 2012


On Wednesday, 14 November 2012 at 22:23:17 UTC, Walter Bright 
wrote:
> On 11/14/2012 3:06 AM, Simen Kjaeraas wrote:
>> But the syntax for built-in types is better, in that you don't 
>> need to write:
>>
>> auto x = int(1);
>>
>
> If you're going to argue that D should have some facility to 
> create user-defined literals that are arbitrary sequences of 
> arbitrary characters, I think you're taking Guy's advice way 
> beyond the breaking point.

  Hmmm... Correct me if I'm wrong, but you can create/use 
opAssign, correct? Although that doesn't work during 
initialization...

struct MyInt
{
   int i;
   ref MyInt opAssign(int rhs) {
     i = rhs;
     return this;
   }
}

MyInt x = MyInt(10);
MyInt y; // = 15; //cannot implicity convert
y = 15;

writeln(x);
writeln(y);



More information about the Digitalmars-d mailing list