Re:New in Go 1.20: wrapping multiple errors
by XorNot on Sunday December 11, 2022 @08:58AM
(#33943214)
Then ditch letter mapping and use named parameters: "{day} {month} {year}" etc. The Golang approach already requires complicated string parsing, so a formatting language isn't going to be more complicated, but then the documentation can just tell you exactly what you need to write to get the desired output, rather then debugging whether you got an invisible implied order wrong (with a failure mode of either giving random output, or just literals).
[ Parent
| on HN ]
Re:New in Go 1.20: wrapping multiple errors
by divan on Sunday December 11, 2022 @09:02AM
(#33943240)
But why? It's so handy in practice!
I work a lot with times (not just dates) and having strings like "15:04" make it immediately recognizible, consise and just right.
What I actually lack in Go's time is ability to work with time only without timezone (like, event starts at "12:00", regardless of timezone). But here is the thing - Go is a programming language, and not "framework with solutions for every use case" as many others. So I just spent 10 minutes and wrote my own type for that and use it happily along with time.Time.
Re:New in Go 1.20: wrapping multiple errors
by masklinn on Sunday December 11, 2022 @09:15AM
(#33943372)
> But here is the thing - Go is a programming language, and not "framework with solutions for every use case" as many others.
So... why did they provide a terrible time formatting routine in the first place if it's not a solution to use cases?