RE: Ambiguity of parsing numbers with underscores/methods

2005-08-18 Thread Gordon Henriksen
Larry Wall wrote: > Yes, that's a convenient escape. But really, arguments from principle > aside, the underlying question is what someone will see if they look > at 1.e5, and I suspect most people will see a number with an exponent. > This is a spot where Ruby violates Least Surprise, at least f

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Larry Wall
On Thu, Aug 18, 2005 at 02:40:12AM +0800, Autrijus Tang wrote: : On Wed, Aug 17, 2005 at 11:37:26AM -0700, Larry Wall wrote: : > On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote: : > : 1.e5# all of these... : > : 1._e5 # : > : 1._0e5 # : > : 1.e_0_5_

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Autrijus Tang
On Wed, Aug 17, 2005 at 11:37:26AM -0700, Larry Wall wrote: > On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote: > : 1.e5# all of these... > : 1._e5 # > : 1._0e5 # > : 1.e_0_5_# == 1 * 10^5? > > The last three are illegal because underline is allowed

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Larry Wall
On Tue, Aug 16, 2005 at 05:25:40PM -0400, Roger Hale wrote: : 1.e5# all of these... : 1._e5 # : 1._0e5 # : 1.e_0_5_# == 1 * 10^5? The last three are illegal because underline is allowed only between digits. : The longest-possible-token metarule, common among

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Yuval Kogman
On Tue, Aug 16, 2005 at 16:59:12 -0400, Mark Reed wrote: > On 2005-08-16 16:45, "Nicholas Clark" <[EMAIL PROTECTED]> wrote: > > I'd find it hard defending a language that treated 1.e5 as a method call. > > Guess we shouldn't sign you up for the Ruby Defense League, then? > > irb(main):001:0> 1.e

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-17 Thread Roger Hale
Luke Palmer wrote: On 8/16/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: Hi, 1_234; # surely 1234 1e23; # surely 1 * 10**23 1._5; # call of method "_5" on 1? 1._foo; # call of method "_foo" on 1? 1.e5; # 1.0 * 10**5? 1.efoo; # call of metho

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-16 Thread Mark Reed
On 2005-08-16 16:45, "Nicholas Clark" <[EMAIL PROTECTED]> wrote: > To me, 1.e5 is not ambiguous. But maybe I've had too much dealing with > floating point in a previous life. 1e5 is not ambiguous. 1.0e5 is not ambiguous, just overprecise. 1.e5 is ambiguous. > I'd find it hard defending a langu

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-16 Thread Nicholas Clark
On Tue, Aug 16, 2005 at 08:36:19PM +, Luke Palmer wrote: > On 8/16/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: > > Hi, > > > > 1_234; # surely 1234 > > 1e23; # surely 1 * 10**23 > > > > 1._5; # call of method "_5" on 1? > > 1._foo; # call of method "_

Re: Ambiguity of parsing numbers with underscores/methods

2005-08-16 Thread Luke Palmer
On 8/16/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: > Hi, > > 1_234; # surely 1234 > 1e23; # surely 1 * 10**23 > > 1._5; # call of method "_5" on 1? > 1._foo; # call of method "_foo" on 1? > > 1.e5; # 1.0 * 10**5? > 1.efoo; # call of me

Ambiguity of parsing numbers with underscores/methods

2005-08-16 Thread Ingo Blechschmidt
Hi, 1_234; # surely 1234 1e23; # surely 1 * 10**23 1._5; # call of method "_5" on 1? 1._foo; # call of method "_foo" on 1? 1.e5; # 1.0 * 10**5? 1.efoo; # call of method "efoo" on 1? 1.e_foo;# call of method "e_foo" on 1? 0xFF.de