Arbitrary abbreviations in phobos considered ridiculous

Sean Cavanaugh WorksOnMyMachine at gmail.com
Wed Mar 7 21:10:02 PST 2012


On 3/7/2012 8:20 PM, Kapps wrote:
> On Wednesday, 7 March 2012 at 19:12:25 UTC, H. S. Teoh wrote:
>> Supporting stuff like 5.hours will introduce additional complications to
>> D's lexical structure, though. The lexer will have to understand it as
>> (int:5)(.)(ident:hours) rather than (float:5.)(ident:hours). And then if
>> you actually *wanted* a float, you'd have another ambiguity: 5..hours
>> could mean (float:5.)(.)(ident:hours) or (int:5)(..)(hours). And
>> 5.0.hours just looks... weird.
>>
>>
>> T
>
> Actually, Kenji's pull request for UFCS already takes care of this.
> Things like 5. aren't allowed, nor is 5.f; a number has to follow the
> decimal. So 5.f would invoke UFCS function f with the integer 5. I
> believe this change is already merged, though the rest of the UFCS pull
> request isn't unfortunately.

I can definitely confirm that porting C/C++ floating point literals to D 
is a huge pain in the ass because of this change, so its definitely in 
to the degree it breaks my math and physics libs heavily :)


More information about the Digitalmars-d mailing list