Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Matt Harden
Since the preference is local and/or personal, would it be better to do this in the editor, adding separation on loading a Go source file and removing it on save? It shouldn't be *too* hard to do it on all numbers over a certain length, while avoiding comments and strings. I suppose it would mess u

RE: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread John Souvestre
Ø The grouping of digits in big numbers is not universal. Several different systems are in use globally. This is unfortunate, but I don’t see it as a show-stopper. 100 and 1_000_000 and 100_ would all be legal and result in the same value. Although I personally prefer groups of 3,

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Rob Pike
My obligatory weekly reminder: blog.golang.org/constants. -rob On Wed, Jun 22, 2016 at 9:30 AM, Manlio Perillo wrote: > Il giorno mercoledì 22 giugno 2016 18:11:35 UTC+2, Bakul Shah ha scritto: >> >> I should've realized go automatically coerced float constants to ints. >> Which is worse but n

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Manlio Perillo
Il giorno mercoledì 22 giugno 2016 18:11:35 UTC+2, Bakul Shah ha scritto: > > I should've realized go automatically coerced float constants to ints. > Which is worse but never mind :-) > > There is no coercion. As someone has already written, constants in go are untyped: https://golang.org/ref/spe

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Jan Mercl
On Wed, Jun 22, 2016 at 6:11 PM Bakul Shah wrote: > I should've realized go automatically coerced float constants to ints. Which is worse but never mind :-) Iff the untyped floating point constant is non imaginary and integral. -- -j -- You received this message because you are subscribe

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Bakul Shah
I should've realized go automatically coerced float constants to ints. Which is worse but never mind :-) > On Jun 22, 2016, at 8:57 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Wed, Jun 22, 2016 at 5:54 PM Bakul Shah wrote: > > That can be dealt with an output format. Just as the hex or octa

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Jan Mercl
On Wed, Jun 22, 2016 at 5:56 PM Andy Balholm wrote: > The same is true of brace styles :-P. Brace style is a matter of preference. Wrong digit grouping in a given place on Earth is wrong, not less preferred. -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Jan Mercl
On Wed, Jun 22, 2016 at 5:54 PM Bakul Shah wrote: That can be dealt with an output format. Just as the hex or octal or the "e" input format is lost. > ... in Go there is a slight inconsistency: 1e6 is an int but 1e-6 is a float. The literals 1e6 and 1e-6 are both untyped floating point constant

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Andy Balholm
The same is true of brace styles :-P. But my point is that by not allowing digit grouping, Go avoids style debates on that issue. The grouping could have been standardized with gofmt, but as it is, it is standardized by the compiler to a format that is universally understood (no grouping). And

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Bakul Shah
That can be dealt with an output format. Just as the hex or octal or the "e" input format is lost. With respect to the "e" notation Go seems to be an exception. Perhaps the sole one? Other prog languages I have used treat eas a floating pt. even in Go there is a slight inconsistency: 1e6 is an

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Jan Mercl
On Wed, Jun 22, 2016 at 5:27 PM Andy Balholm wrote: > Actually, the mention of gofmt brings up the issue of consistent formatting. If underscores in numbers were allowed, gofmt should automatically insert them for all numbers over a given length, and remove them for shorter numbers. The grouping

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Andy Balholm
Actually, the mention of gofmt brings up the issue of consistent formatting. If underscores in numbers were allowed, gofmt should automatically insert them for all numbers over a given length, and remove them for shorter numbers. Otherwise it would just be another opportunity for inconsistency,

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Michael Jones
Sorry, I sent that too soon. One argument against underscores in numbers and other discardable syntax is the tooling in Go to parse and regenerate go code, as in gofmt. It may be more complicated to keep the “original input format” around and that is a pretty good argument—unless that is alrea

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Michael Jones
> https://github.com/golang/go/issues/42 Michael Jones michael.jo...@gmail.com > On Jun 22, 2016, at 7:29 AM, Roger Pack wrote: > > Could you drop me a link to the discussion by chance? Seems this > feature is actually a reasonably common request :) -- You received this message because you ar

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Roger Pack
Could you drop me a link to the discussion by chance? Seems this feature is actually a reasonably common request :) On Tue, Jun 21, 2016 at 12:47 PM, Michael Jones wrote: > I asked for this a while back ("drop underscore between digits as in Ada") > and the answer was no. I try to ask just once.

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Ian Lance Taylor
On Wed, Jun 22, 2016 at 6:50 AM, Manlio Perillo wrote: > On Wed, Jun 22, 2016 at 3:35 PM, Henrik Johansson > wrote: >> Really? > > Yes. > The problem is that many people coming from C like languages may > incorrectly assume that i is a floating point number. This doesn't strike me as a good rea

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Manlio Perillo
On Wed, Jun 22, 2016 at 3:35 PM, Henrik Johansson wrote: > Really? Yes. The problem is that many people coming from C like languages may incorrectly assume that i is a floating point number. Manlio > I find that counting digits in large numbers is harder, for me at > least, than expected. The

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Henrik Johansson
Really? I find that counting digits in large numbers is harder, for me at least, than expected. The scientific notation is sweet. On Wed, Jun 22, 2016, 14:57 Manlio Perillo wrote: > Il giorno martedì 21 giugno 2016 18:35:13 UTC+2, Caleb Spare ha scritto: >> >> This was shut down without much dis

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-22 Thread Manlio Perillo
Il giorno martedì 21 giugno 2016 18:35:13 UTC+2, Caleb Spare ha scritto: > > This was shut down without much discussion at > https://github.com/golang/go/issues/42. > > I agree that it's a nice feature. > > By the way, though, one nice aspect of Go is that because of how > untyped constants wor

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-21 Thread Michael Jones
I asked for this a while back ("drop underscore between digits as in Ada") and the answer was no. I try to ask just once. This was shut down without much discussion at https://github.com/golang/go/issues/42. I agree that it's a nice feature. By the way, though, one nice aspect of Go is that beca

Re: [go-nuts] feature request: allow literal digit underscore grouping

2016-06-21 Thread Caleb Spare
This was shut down without much discussion at https://github.com/golang/go/issues/42. I agree that it's a nice feature. By the way, though, one nice aspect of Go is that because of how untyped constants work you can write integers using scientific notation: for i := 0; i < 10e6; i++ { //