Re: R suffix for reals

2012-05-07 Thread Manfred Nowak
Walter Bright wrote: never encountered a problem with it Please recall the famous `fori=' vs. `for i=' mistake: one unintentional changed or added character might change the meening of the code but compile undetected: | auto x = +1L; | auto y = -1L; | auto z = .1L; Whereas | auto z =

Re: R suffix for reals

2012-05-07 Thread Arne
On Monday, 7 May 2012 at 12:34:26 UTC, Steven Schveighoffer wrote: On Sun, 06 May 2012 21:02:28 -0400, bearophile bearophileh...@lycos.com wrote: Or maybe you initially have written: auto r = 1.1L; And later you want to change the number to 1.0 and you fix it like this: auto r = 1L; Now you

Re: R suffix for reals

2012-05-07 Thread Steven Schveighoffer
On Mon, 07 May 2012 14:11:34 -0400, Arne a...@linux.nu wrote: On Monday, 7 May 2012 at 12:34:26 UTC, Steven Schveighoffer wrote: On Sun, 06 May 2012 21:02:28 -0400, bearophile bearophileh...@lycos.com wrote: Or maybe you initially have written: auto r = 1.1L; And later you want to change

Re: R suffix for reals

2012-05-07 Thread Walter Bright
On 5/7/2012 12:07 PM, Steven Schveighoffer wrote: However, I think these examples are misleading and do not prove the point. It shows IMO more that you are better off declaring the type on the left if your code depends on it always staying the same. i.e. this does not have that problem: real r

R suffix for reals

2012-05-06 Thread bearophile
R suffix for reals This is small enhancement suggestion :-) (Issue 8049). The f suffix turns a number literal without . into a float, while L requires a . in the number literal, otherwise you have defined a literal of type long: void main() { auto x1 = 1f; static assert

Re: R suffix for reals

2012-05-06 Thread James Miller
On Sunday, 6 May 2012 at 22:49:13 UTC, bearophile wrote: R suffix for reals This is small enhancement suggestion :-) (Issue 8049). The f suffix turns a number literal without . into a float, while L requires a . in the number literal, otherwise you have defined a literal of type long: void

Re: R suffix for reals

2012-05-06 Thread Matej Nanut
I didn't know about the decimal-point + L notation for reals. It does seem... surprising. I don't see a reason why ‘R’ wouldn't be a good choice. I also don't see why someone would write ‘1.0L’ and expect a long.

Re: R suffix for reals

2012-05-06 Thread Jonathan M Davis
On Monday, May 07, 2012 00:49:11 bearophile wrote: R suffix for reals This is small enhancement suggestion :-) (Issue 8049). The f suffix turns a number literal without . into a float, while L requires a . in the number literal, otherwise you have defined a literal of type long: void

Re: R suffix for reals

2012-05-06 Thread bearophile
Jonathan M Davis: And what is so onerous about having to do 1.0L instead of 1R? It's not onerous, the purpose of R is not to save typing .0. (it would have to be either double or real, and apparently it's real). 1.0L is always a real in D. We _could_ add R, but I don't really see what

Re: R suffix for reals

2012-05-06 Thread Mehrdad
That's why you shouldn't http://www.quickmeme.com/meme/3p5mcu/ On Monday, 7 May 2012 at 01:02:29 UTC, bearophile wrote: Jonathan M Davis: And what is so onerous about having to do 1.0L instead of 1R? It's not onerous, the purpose of R is not to save typing .0. (it would have to be

Re: R suffix for reals

2012-05-06 Thread Jonathan M Davis
On Monday, May 07, 2012 03:02:28 bearophile wrote: Jonathan M Davis: And what is so onerous about having to do 1.0L instead of 1R? It's not onerous, the purpose of R is not to save typing .0. (it would have to be either double or real, and apparently it's real). 1.0L is always a

Re: R suffix for reals

2012-05-06 Thread Era Scarecrow
On Monday, 7 May 2012 at 01:02:29 UTC, bearophile wrote: Jonathan M Davis: And what is so onerous about having to do 1.0L instead of 1R? It's not onerous, the purpose of R is not to save typing .0. If you write auto x = 1L; thinking about defining a real, as you define a float with auto x

Re: R suffix for reals

2012-05-06 Thread Walter Bright
On 5/6/2012 6:46 PM, Jonathan M Davis wrote: I'm sorry, but I think that you're making an issue out of nothing. 1L is clearly a long, not a real, and you're going to get compilation errors very quickly if you really meant to have a real. Yes, there _are_ cases where you could have a silent,

Re: R suffix for reals

2012-05-06 Thread Era Scarecrow
On Monday, 7 May 2012 at 02:19:19 UTC, Walter Bright wrote: I agree. It's as old as C, and I've never encountered a problem with it. And as Era Scarecrow posted, this leads to suffixes for every type. Only if you had to be specific to clarify certain confusion. 95% or more of the time the

Re: R suffix for reals

2012-05-06 Thread Walter Bright
On 5/6/2012 7:33 PM, Era Scarecrow wrote: Was mostly commenting when I see L, I think 'long' right away, not 'long or possibly float/double'. The L comes from C and meant of long double.

Re: R suffix for reals

2012-05-06 Thread Era Scarecrow
On Monday, 7 May 2012 at 03:42:18 UTC, Walter Bright wrote: On 5/6/2012 7:33 PM, Era Scarecrow wrote: Was mostly commenting when I see L, I think 'long' right away, not 'long or possibly float/double'. The L comes from C and meant of long double. Interesting; But still for me (and likely