Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-07-06 Thread Lucio De Re
On 7/6/19, Jakub Labath wrote: > "And yes go does have panic/recover - but I never use them for the same > reasons I > dislike exceptions. It's just really hard to reason about such jumps in logic > especially > in massively concurrent programs that go allows us to write." I agree with everythi

Re: [go-nuts] Re: ioutil.ReadDir sort order

2019-07-06 Thread Michael Jones
Indeed, you have two choices: create file names with fixed width numbers: Printf “file%08dv%02d.dat”, f,v Or do a string/number parse of the names before sorting and separate the numbers, you can insert spaces/zeroes and then string sort, or you can parse the numbers and compare them numerically.

Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-07-06 Thread Michael Ellis
> Exception handling when properly done is beautiful. Yes and so are: - C++ templates - Python meta-classes - Scheme hygienic macros but that doesn't mean Go would be improved by adding them. On Friday, July 5, 2019 at 6:46:49 PM UTC-4, robert engels wrote: > > If you’ve suffered throug

Re: [go-nuts] Re: ioutil.ReadDir sort order

2019-07-06 Thread Dan Kortschak
It's sorted lexically by the unicode code points. Why would str1 come after str2? '1' < '9'. On Fri, 2019-07-05 at 21:23 -0700, shubham.pendharkar via golang-nuts wrote: > It sorts by name, but there is a big problem with golang string > comparison. > If you consider these two strings: > str1 : "h

[go-nuts] Re: ioutil.ReadDir sort order

2019-07-06 Thread shubham.pendharkar via golang-nuts
It sorts by name, but there is a big problem with golang string comparison. If you consider these two strings: str1 : "hello.20190305-102.txt" str2 : "hello.20190305-99.txt" Then we should say that str1 > str2. But go returns str1 < str2 On Wednesday, August 19, 2015 at 3:10:41 PM UTC+5:30, Arie