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 languages, would want : all of these to be numbers. I see that perl5's lexer has this rule (3rd : edition, p49); is not perl6's specced to have it as well? If it's not a metarule, it's at least a metametarule. : Likewise, if hex numbers allow fractions, : : 0xDE_AD.BE_EF # 57005.7458343505859375 ? : 0xde_ad.be_ef # same : : should be taken as a number. (Naturally 'e' as exponent marker is here : problematic.) It's a problem even without fractions. I expect we can just disallow the exponent at that point and rely on constant folding. Or maybe there's some colon trickery we can do, so the general form might be something like: 16:abcd.ef:+23. (I'm presuming the exponent is always decimal, like the radix.) Of course, then someone will suggest that infix :+ means "* 10 **" and we get things like $foo:+23. So maybe we should come up with a better way to write that and then just go the constant folding route. 16:abcd.ef*e(23) maybe, if you don't mind clobbering the e() function. But we can always stick with 16:abcd.ef*10**23. The situation probably doesn't arise often enough to justify syntactic sugar. I suppose I could just barely see dropping the 10 there to get 16:abcd.ef***23, but then we'd have to put up with $foo ***= 23; : If one wants to call a method on a number, surely one may follow the : usual advise and write : 1 ._5 : 1 ._foo : 1 .efoo : 1 .e_foo : 0xFF .dead : ? 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 for people who aren't used to seeing methods hanging off of literals. Larry