4 ms·
Thanks for this—easier to digest than other posts I’ve seen. The ability to restrict interfaces to specific types is pretty cool (unique?) but otherwise seems l
by sszz 6y ago
Thanks for this—easier to digest than other posts I’ve seen. The ability to restrict interfaces to specific types is pretty cool (unique?) but otherwise seems like generics as usual, but with a distinct Go flavor. Looking forward to using this and cleaning up some boilerplate!
- maybeOneDay 6y agoUnless I'm missing something I can't see any constraining ability that isn't possible in C#[0], for example? [0] https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/generics/constraints-on-type-parameters https://docs.microsoft.com/en-us/dotnet/csharp/programming-g...
- scns 6y agoMaybe you are missing that this is not possible in Go yet?
- throwaway894345 6y agoI do wish people would resist the reflex to overtly digress onto their own favorite programming language in any given programming HN thread. I'm not talking about insightfully comparing two languages; I'm talking about going completely off-topic because you want to talk about your own favorite language.
- maybeOneDay 6y agoIf this is in reference to my bringing up of C# - I did so in order to talk about whether or not Go has generic constraints which are unique (which would be awesome!). I used C# as an example of a language that has constraints that are the same as/as powerful as those in this Go proposal so as not to be making an unsubstantiated claim.
- roblabla 6y agoOP specifically said the constraining mechanism was unique, hence why GP (and myself) are curious about what makes it more interesting/powerful than what exists in other languages like C#.
- maybeOneDay 6y agoI was questioning the uniqueness of the feature is all - it seems to me that there isn't anything unique about the constraints available in Go.