refined sugar (was DMD 0.165 release)

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Wed Aug 23 01:45:10 PDT 2006


Carlos Santander wrote:
> Pragma escribió:
>>
>> I'm not too crazy about '=>' but something like using {} without an 
>> embedded return (as others have mentioned) might be the right trick.  
>> As long as it has the same behavior as the explicit cast() above, it 
>> has my vote.
>>
>> foobar("value");
>> foobar({"value"});
>>
>> It's subtle, yet impossible to confuse for anything else.
>>
> 
> I also want it to be explicit someway, and I liked {} but what if struct 
> initializers get added? (did I get my wording right?)
> 
> struct A { char [] txt; }
> 
> void foo (char [] txt) {} // #1
> void foo (char [] delegate () dg) {} // #2
> void foo (A a) {} // #3
> 
> ....
> 
> foo ({"hi!"});
> 
> How does the compiler know which one we want? Casting would be an 
> option, but I think it'd be too verbose most of the time.
> 
> So, while I don't like => either, some other operator along those lines 
> maybe better. Following the previous example:
> 
> foo ("hi!") // calls #1
> foo ({"hi!"}); // calls #3
> foo (=> "hi!"); // calls #2
> 
> Ok, maybe => doesn't look so bad after all :P
> 

I have to agree with this, => does keep looking better and better..



More information about the Digitalmars-d-announce mailing list