Why has the math
bundle (and possibly others) not been rewritten utilizing generics? It has been years now, since we had generics, and I nonetheless need to convert backwards and forwards between float64
and float32
/intXX
when utilizing the math.Abs()
operate, for example.
It seems like math.Abs()
ought to settle for all numeric varieties, and all trigonomical features, like math.Sin()
and so forth, ought to settle for at the very least float64 and float32.
Is there a motive for this, that I don’t perceive?
1 Like
Attention-grabbing, however why wasn’t it merged in 2022? What does it imply when Rob Pike says: Patch Set 1: Maintain+1?
And it additionally fastened solely the math.Abs()
operate…
Observe the hyperlinks to the opposite discussions.
Okay, thanks, now I perceive why it was rejected, I nonetheless assume although {that a} new bundle ought to be created as an alternative, for instance math2
, that helps generics. Backwards compatibility will likely be saved since math
nonetheless exists…
Yeah, I don’t disagree that it’d be good, I don’t know that creating that form of precedent in stdlib is the very best answer, however as per that dialogue, I don’t know that there’s any good answer. I’m unsure what stage of motivation there’s to resolve it in stdlib contemplating how straightforward it’s to have your individual workaround/wrapper in your individual initiatives.
1 Like
And that’s the place I believe we disagree just a little bit. I don’t wish to have my very own workarounds for a “flawed” or “restricted” customary library in my very own initiatives. I get bored with fixing the usual library
I really like the thought of holding the Go language small, however I don’t love holding the usual library as minimized because the language…However I suppose I’ll simply have to just accept it as it’s…
Yep, in all languages, however particularly low stage ones, I all the time find yourself with my very own touring lib of useful ins and outs. Reality is I find yourself with that in all areas of life, I’ve all kinds of jigs and different selfmade instruments for carpentry and dealing round the home too. So yeah, I suppose I’m biased in the direction of that form of toolkit