develooper Front page | perl.perl6.language | Postings from June 2010

Re: underscore in numbers

Thread Previous
From:
Jonathan Worthington
Date:
June 17, 2010 17:05
Subject:
Re: underscore in numbers
Message ID:
4C1AB842.90709@jnthn.net
Aaron Sherman wrote:
> The spec says, and NQP seems to implement (Rakudo, I think, picks up
> <integer> from NQP as defined in HLL-s0.pir, is this right?) that a
> single underscore is ignored between any two digits in a number, not
> between the radix and the number. However, it seems to me that this
> would be very handy:
>
>  0b_1111_0000 instead of 0b1111_0000
>  0x_dead_beef instead of 0xdead_beef
>  0d_1_000_000 instead of 0d1_000_000
>
> ... just in terms of the clarity gain from keeping the radix at arms
> length from the rest of the integer literal.
>
> Just a thought.
>
>   
It seems that Larry agrees, since he just patched the spec. :-)

> I tried this change against parrot to test it out, but it didn't seem
> to make any difference, so I must be missing something:
>
>   
Unfortunately, you edited a (probably poorly marked as such) generated file.

The actual change would need to be made to nqp-rx - Parrot just keeps 
compiled copies of that in its repo. That can be found at:
http://github.com/perl6/nqp-rx/

And likely just needs a tweak to a Perl 6 grammar rule rather than some 
PIR hacking. :-)

Thanks!

Jonathan


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About