5 ms·
Can't wait for the thing to land. My only remaining wish is sum types
by qaq 5y ago
Can't wait for the thing to land. My only remaining wish is sum types
- rawoke083600 5y agoTHIS ! and "pattern-matching" :)
- a-saleh 5y agoSo, in the end all of languages move closer to StandardML :D Like even python has sum-types and pattern matching now!
- rawoke083600 5y agoLol I know I know... but it is so useful :)
- xmorse 5y agoThat would be awesome!
- tonyedgecombe 5y agoAnd exceptions :)
- szastamasta 5y agoPlease, just not exceptions.
- mseepgood 5y agoPanic and recover already exist, which are semantically exceptions.
- k_bx 5y agoWere there discussions? What is the general impression, is there hope?
- yutijke 5y agoI have never used golang but from my reading of the type parameters proposal, it also includes an approximation of "Sum types". You can define an interface with a closed set of types type Number interface { float64, int64, ... } Now, the value will be boxed, so you will not have no-allocation sum types but you can approximate boxed sum types with this I think.
- cube2222 5y agoApproximating closed sum types is easy already, by creating an interface with a stub private method and implementing it for all variants. Then it's not possible to implement it using a type outside of that package. The main thing that's lacking is compile time checks whether variant matching is exhaustive.
- zerr 5y agoAny updates regarding the if-hell of error handling?
- neetle 5y ago"Try another language instead" is always a valid option. There isn't anything wrong with a language just not jiving with your sensibilities.
- chakkepolja 5y agoProblem is, perfect language with perfect libraries and perfect tools doesn't exist.
- cy_hauser 5y agoNo, it's not. It's just being dismissive because your wants are being met by the current state.
- mseepgood 5y agoThey spent months consolidating feedback and made two proposals. The community didn't want change. Now they are no longer working on it and are focusing on getting generics out.