Complete floating point literals

Nick Sabalausky a at a.a
Sat Jul 9 12:13:34 PDT 2011


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:iva982$dm8$1 at digitalmars.com...
> This comes from a small sub-thread in D.learn (but I have asked for it the 
> first time in bug 3837 time ago):
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=28030
>
> I suggest to turn floating point literals like the following into syntax 
> errors (maybe just deprecated, so they get accepted using the -d compiler 
> switch), because the saving of one digit is not worth the small troubles 
> they cause now and then:
>
> .5
> 3.
>
> And require to write them like this:
>
> 0.5
> 3.0
>
> The enhancement request:
> http://d.puremagic.com/issues/show_bug.cgi?id=6277
>
> (Daniel Murphy suggests to allow 1.f and 1.L (and maybe .2f and .2L too) 
> but I think this is a special case).
>
> (I think disallowing 3. is also useful if you want to allow the 
> introduction of the .. or ... interval syntax. The trailing FP dot causes 
> some troubles and asks for an extra space).
>
> What do you think?
>
> If I see enough people against this idea I will probably close the 
> enhancement request.
>

I see zero benefit to the 1., .1 feature and it's been a problem in syntax 
discussions in the past. I'm completely in favor of ditching it, and have 
already put in a bugzilla vote for bearophile's enhancement request.





More information about the Digitalmars-d mailing list