Earlier quoted context omitted.
>For example, the entire error thing is absurd. Anders Hejlsberg got this right many years ago: 9 out of 10 errors are "handled" by a central error handler (log + "sorry, try again"). You are correct that this is how it's often done - 9 out of 10 errors probably ARE "handled" by a central error handler. But this is an incorrect approach if the goal is a reduction of catastrophic errors. In the following paper, "Simpl…
Depends on the app. In GUI, yes, why not, display an error message and you are done. In infrastructure software, OTOH, you want to handle errors in thoughtful manner. If you can't it's often better to crash the application than to continue with broken state.
Why I’m Frustrated with Go
91–100 of 233 posts
Re: Why I’m Frustrated with Go
#92Earlier quoted context omitted.
> const std::set s // This is immutable. > Foo() : s(helper()) {} // This is a move, not a copy. First, I'll point out that the data of s is not immutable. The fact that you can const_cast away the const and change the value makes that clear. If people do things like that (or corrupt memory or have race conditions in the code), C++ doesn't necessarily give you clear exceptions or compiler errors. Many of the ways to…
const std::set s; // This is immutable. const_cast &>(s).emplace(); // This is UB.
Re: Why I’m Frustrated with Go
#93Earlier quoted context omitted.
I don't know specifically why that is for this specific project, but in general Go has GC and bounds checking that slow things down.
Rust bounds-checks indexes by default (there exist indexing methods which bypass that, they are unsafe).
Re: Why I’m Frustrated with Go
#94Out of curiosity, what is the use case for immutable structs? (asking as I'm a ruby/js/go dev and as such I've never used such idiom)
Basically, something that takes coder discipline in Ruby/JS/Go is handled a compiler/runtime enforced restriction.
Re: Why I’m Frustrated with Go
#95Earlier quoted context omitted.
And java doesn't have them either. You need to use an external library, likely the google containers library.
But you can build and use generic immutable collections.
This is possible, but it's an unfortunate form of code duplication.
Re: Why I’m Frustrated with Go
#96Earlier quoted context omitted.
> I don't have much experience with elixir, but that's because I like to stay employed. While the previous commenter gave an objective and rational overview why he think Go gives him a hard time you can't resist to get polemic.
I gave rational counter arguments and employment is pretty important too imo. It seems a lot of the anti-Go people tend to favor languages that no one gets paid to use.
Re: Why I’m Frustrated with Go
#97I did Go for years, but stopped doing any serious work in it about a year ago. In general, I found it a chore to maintain Go-based systems. There's a lot to like about Go. But it doesn't seem pragmatic for the types of applications I see people using it for. For example, the entire error thing is absurd. Anders Hejlsberg got this right many years ago: 9 out of 10 errors are "handled" by a central error handler (log +…
Re: Why I’m Frustrated with Go
#98I am not sure where the authors exact requirements fit in the greater picture of the desired application. But one important tool which works great in Go is functional representation. If you want e.g. an immutable map, make it a structure with private fields, and give access vial functions (methods). The first comment to the article describes a nice example of this approach. I often read criticism of Go which is based…
The author discounts this as a good solution because you'd have to re-implement the structure and functions for every single type you might put in the map; i.e. that would be a valid solution iff Go supported generics, but it does not.
But it can be done.
Re: Why I’m Frustrated with Go
#99Earlier quoted context omitted.
> This is especially true when your system is interacting with external data - like user input and a database. I did C# and Java for years. These interactions are, at best, painful with static languages. Why? I find when you're importing external data or user input, that's exactly where you want strong types as that's the most likely place unexpected values are going to be generated (e.g. unexpected null values, stri…
I don't disagree. It's just more tedious in static languages. Let's say we're doing a user registration. In most dynamic languages the JSON body will get parsed into a map. Excuse the fat controller and pseudo-language, but it'll end up looking something like: func create(conn, params) do if not Validator.is_email?(params["email"]) do return error(conn, "email is not valid") end if not Validator.min_length?(params["p…
Re: Why I’m Frustrated with Go
#100Where is the list of problems that are easier to solve with generics?