7 ms·
With this another most requested feature is covered by Go. This leaves error handling, enum type which are often asked by users but are not actively being worke
by geodel 3y ago
With this another most requested feature is covered by Go. This leaves error handling, enum type which are often asked by users but are not actively being worked on for now.
- earthboundkid 3y agoAn iterator type is being actively worked on now. After that presumably the missing data types in the standard library will be filled out (set, deque, a usable heap, whatever other algorithms). After that, who knows. Maybe native bigints? I don’t really see the enum thing happened. Is lack of enums a real problem? Theoretically, it would be convenient, but I can’t say that I see bugs caused by its lack.
- howinteresting 3y agoEnums with associated values are a very basic data modeling primitive. Writing code without them is like doing arithmetic with only the multiplication sign, not the plus sign.
- LambdaComplex 3y agoHaving "type MyType int" and defining a bunch of constants isn't a great replacement for enums. Yeah, it "works," but it still lets the developer forget to check for a possible variant, or you could have an underlying int that doesn't correspond to a valid variant. The addition of enums would move all these runtime checks to compile time.
- deleted 3y ago[deleted]
- euroderf 3y agoAs a workaround, a list in a DB combined with a foreign key constraint. Ugly, yes.
- jmarchello 3y agoThe lack of Error Handling in Go is a feature, not a bug. See here: https://go.dev/doc/faq#exceptions https://go.dev/doc/faq#exceptions. I think I'd be disappointed if Try/Catch ever made their way into the language.
- progbits 3y agoError handling != exceptions. Step one would bee sum types, so only valid value space can be represented (return value or error, but not both or neither).
- jmarchello 3y agoGood point, a poor assumption on my part
- wizhi 3y agoWhat would be the big gain from this, over the existing approach using multiple return values?
- geodel 3y agoI am not demanding either of these things. Just making general comment based on observing folks.
- dinkleberg 3y agoYeah I have to agree that the Go-style error handling does actually lead to better code. At least when I write it. It makes me think through how I am going to handle error states rather than chucking it in try/except in Python and hoping nothing breaks lol.
- deleted 3y ago[deleted]
- jen20 3y agoRust-style error handling works better though - similar to Go, but with the addition of enums such that the precise types of errors which may be encountered can be easily documented in the type system.