[Pharo-dev] Re: PhEP: Underscores in Numeric Literals

2023-02-14 Thread Noury Bouraqadi
I like it.
I assume that the enhancement will include converting strings to numbers

'10_000' asNumber = 10_000
Noury
On Feb 14 2023, at 9:30 am, Guillermo Polito  wrote:
> +1
>
> > El 13 feb. 2023, a las 20:37, Daniel Slomovits  > (mailto:daniels...@gmail.com)> escribió:
> > Seems reasonable to me. I was just wishing for such a thing for exactly the 
> > reason you mention (keeping track of zeroes in large integer literals). 
> > AFAICT you've done a pretty good job laying out the possible error 
> > conditions. I think your option 1 makes sense—the error-prone-ness is the 
> > sort of thing that could happen in theory, but I'm not too worried about in 
> > practice. Or option 2 is fine, I'm just not familiar enough with the parser 
> > to know how much harder it might be to implement.
> > On Mon, Feb 13, 2023 at 1:54 PM Privat, Jean  > (mailto:privat.j...@uqam.ca)> wrote:
> > > This PhEP describes the extension of Pharo numeric literals to accepts 
> > > (and ignore) underscore characters (`_` ASCII 95).
> > >
> > > Many languages (including Python https://peps.python.org/pep-0515/ , Java 
> > > https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html
> > >  or Ruby) accept some forms of numeric literal that ignore _.
> > > The idea is to permit long literals that are still readable, eg. 
> > > `1_000_000_000` is easier for a human than `1` especially since 
> > > in the previous literal a zero is missing (I'm a tricky deceitful fellow).
> > > The details of the proposal are in the PR: 
> > > https://github.com/pharo-project/pheps/pull/16
> > > --
> > > Jean Privat
> >
> >
> >
>
>



[Pharo-dev] Re: PhEP: Underscores in Numeric Literals

2023-02-14 Thread Guillermo Polito
+1

> El 13 feb. 2023, a las 20:37, Daniel Slomovits  
> escribió:
> 
> Seems reasonable to me. I was just wishing for such a thing for exactly the 
> reason you mention (keeping track of zeroes in large integer literals). 
> AFAICT you've done a pretty good job laying out the possible error 
> conditions. I think your option 1 makes sense—the error-prone-ness is the 
> sort of thing that could happen in theory, but I'm not too worried about in 
> practice. Or option 2 is fine, I'm just not familiar enough with the parser 
> to know how much harder it might be to implement.
> 
> On Mon, Feb 13, 2023 at 1:54 PM Privat, Jean  > wrote:
> This PhEP describes the extension of Pharo numeric literals to accepts (and 
> ignore) underscore characters (`_` ASCII 95).
> 
> Many languages (including Python https://peps.python.org/pep-0515/ 
>  , Java 
> https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html
>  
> 
>  or Ruby) accept some forms of numeric literal that ignore _.
> 
> The idea is to permit long literals that are still readable, eg. 
> `1_000_000_000` is easier for a human than `1` especially since in 
> the previous literal a zero is missing (I'm a tricky deceitful fellow).
> 
> The details of the proposal are in the PR: 
> https://github.com/pharo-project/pheps/pull/16 
> 
> 
> --
> Jean Privat