Live data from Hacker News

I want off Mr. Golang’s Wild Ride (2020)

fasterthanli.me

311–320 of 477 posts

Re: I want off Mr. Golang’s Wild Ride (2020)

#311

Earlier quoted context omitted.

> So, you unthinking prat, what do you recommend he should have done, carried on coding much near-duplicate code by hand or get the computer to do the repetitive job infinitely faster and more safely? No, my recommendation would be to use a different language that doesn't need a preprocessor. Use any more insults and I'm just going to flag you.

You don't get always to choose your language, and even then there will be stuff that needs automated cut & paste at a level that the language can't provide (even down to the lexeme level). Which is why I use generated code for my C# work. I use python rather than a preprocessor but either would do. Prepros and code generation in general are just tools, no more nor less, and not good or bad intrinsically. There is no…

I use preprocessors for Java. I'm not averse to using them when I have to work in a more verbose language.

And you are right that we often don't have a choice of language to work in.

But they are still a sign that the language you are using is deficient. Preprocessors may ameliorate those problems somewhat, but they come with their own costs and complexities.

For anyone who is in the position of making a language choice, the fact that a given language community relies heavily on such tools should be a reason to avoid that language.

Re: I want off Mr. Golang’s Wild Ride (2020)

#312

What would be a good alternative to Go, with - large and well maintained standard lib - great runtime characteristics - esp. reasonable memory usage - developer ergonomics - matureness - long term stability - preferably managed memory I really have used a lot of languages. They all have some downsides. I like Kotlin a lot but the JVM is just to cumbersome and resource heavy. Grade is way to complex. Rust is way to cu…

I've been tempted to consider kotlin + graalvm as an option as well. Graalvm is getting pretty cool, but it does add some complexity, and it's too tied to Oracle in my opinion...

C# might be cool again as well though, haven't really considered that since before .NET core.

(And I think Go is ok, but I find coding in kotlin more enjoyable)

Re: I want off Mr. Golang’s Wild Ride (2020)

#313
post #285
post #142

Earlier quoted context omitted.

> > in practice, Go seems to have fewer error handling bugs than exception-based languages > > This is based on? By explicitly annotating functions as fallible the language hints to the programmer that errors need to be accounted for. With exceptions, the hints only appear at runtime - when your program crashes. There's nothing that nudges you towards handling errors at the point of writing code, so you end up with b…

Checked exceptions are a thing. Java’s implementation is unfortunately not perfect, but exceptions themselves are analogous to basically Rust’s Result type, but it has in-built support on a language level which packs the stack trace into the error case and auto-bubbles up if not handled. I believe a language where instead of subtypes you would get algebraic data types and could optionally mark whether a given excepti…

> auto-bubbles up if not handled

I'm guessing you already know this, but for anybody else reading - this isn't entirely accurate; Result::Err doesn't auto bubble up like an exception, you have to manually bubble it up. The "special sauce" comes from (A) the compiler forcing you to notice this and do something about it, and (B) the `?` syntactic sugar to make that super easy.

It does occur to me as I'm typing this that you might be talking about panics, though, in which case yeah that's entirely accurate.

Re: I want off Mr. Golang’s Wild Ride (2020)

#314
post #90

Earlier quoted context omitted.

> Go is a language that gets out of your way, encourages you to solve your problem Maybe I'm just too dumb for Go, but this is not consistent with my experience at all. Go's insistence on pretending that complexity doesn't exist would get in my way all the time. Go's extreme hostility toward FFI calls got in my way several times.

Go always seems to be to be designed to be simple for the compiler (which, to be fair, has benefits: fast compilation is useful in a compiled language, to keep code-build-test cycles short) more than the programmer.

Go strives for a balance. It tries to be a fast language without trading off everything else to that end. So it has a GC and really fast builds and it produces machine code that isn't as aggressively optimized as Rust or C++, but it does so much more quickly (as you noted). These are ideal tradeoffs for a huge swath of applications.

Re: I want off Mr. Golang’s Wild Ride (2020)

#315
post #90

Earlier quoted context omitted.

> Go is a language that gets out of your way, encourages you to solve your problem Maybe I'm just too dumb for Go, but this is not consistent with my experience at all. Go's insistence on pretending that complexity doesn't exist would get in my way all the time. Go's extreme hostility toward FFI calls got in my way several times.

Yea.. i used Go for 5 years. I just can't agree that the simplicity is true. Yes, the language itself is, but it offloads complexity into my program and thus my day to day is jumping around huge piles of logic which could be made for easier to reason about and understand with some actual help in managing the complexity. Your complex programs aren't easier in Go, in my experience. The simplicity of the language doesn'…

> runtime costs of the overuse of Interface{} (prior to Generics at least)

Generics aren't going to improve this situation - at least not the current iteration of generics :(

Re: I want off Mr. Golang’s Wild Ride (2020)

#316

Earlier quoted context omitted.

Errors as return values is only acceptable for code that is so performance-sensitive that you aren't allowed to do dynamic memory allocations. For everything else, conditions+restarts are the correct answer, because errors-as-values restricts you to a single error-handling strategy and couples high-level code to low-level code as a result.

> Errors as return values is only acceptable for code that is so performance-sensitive that you aren't allowed to do dynamic memory allocations Not really. It is acceptable for code whose maintainers value readability and simplicity over everything else. I totally agree that readability and simplicity are quite subjective and this is up to the maintainers. I don't really know what "conditions+restarts" is but a few a…

> It is acceptable for code whose maintainers value readability and simplicity over everything else.

Errors-as-return values are less readable than conditions, not more - there's literally more visual noise on the screen.

And if you want "simplicity", don't use a computer. Computers are intrinsically complex devices, users desire features with complex implementations, and our job as programmers is to manage complexity, not pretend that it doesn't exist. One of the article's main points is that Go does the latter in lieu of the former, and that's also what errors-as-return-values does.

----------------------------------

The formal name for a condition+restart system appears to be "algebraic effects"[1].

Conditions and restarts are similar to exceptions, with the following changes:

First, conditions are conceptually used for non-error conditions in some cases, like what Python does.

Second, throwing a condition doesn't cause the stack to unwind up to the handler, unlike exceptions.

Third, in addition to throwing conditions, you, uh, wrap ("establish" is the jargon used) code in what are called "restarts", similar to wrapping things in try/catch blocks (but distinct, because with conditions you still have condition handling blocks). Restarts can have names and are non-mutually-exclusive. Conceptually, restarts represent error-recovery strategies, while conditions represent the errors themselves.

Fourth, when a condition is thrown, it propagates upward until it hits either the toplevel (in which case the interactive debugger is launched), or it hits a condition handler - without unwinding the stack. Then, either the human looking at the debugger can pick which restart they want to use, or the logic at the condition handler can do so.

Why is this better than any alternative error-handling mechanism? Because every other error-handling mechanism (1) unwinds the stack (destroying all contextually useful information that isn't explicitly saved by the programmer, and preventing you from restarting a computation in the middle) (2) forces you into a single error-recovery strategy and (3) couples low-level code to high-level code as a result.

In general, low-level code has details about the specific kind of error, context around it, and access to data and control flow that would allow the error to be recovered from (e.g. for a log-processing program, reasonable restarts while parsing a log entry would be (1) skip it (2) retry (3) use an alternative parser and (4) return an empty entry), while high-level code has the application context about why the low-level operation is being performed in the first place and which error-recovery option should be picked.

Conversely, high-level code doesn't have details about what the low-level code was doing at the time of the error, and low-level code doesn't have the high-level context necessary to determine which error recovery strategy is appropriate in this use of the low-level code.

[1] https://en.wikipedia.org/wiki/Effect_system

https://en.wikipedia.org/wiki/Exception_handling#Condition_s...

Re: I want off Mr. Golang’s Wild Ride (2020)

#317

Earlier quoted context omitted.

What an extremely convenient template to dismiss any nuanced argument against "worse is better". You even get to question my credentials a couple times! (I apparently pick metrics that are convenient to my argument, and fundamentally misunderstand programming language design). Even if I accept the premise that "I'm challenging Go on things it doesn't promise to deliver" (which is disingenuous to begin with — correctn…

I think it's a matter of different goals. What you describe is pains of a very senior developer who has worked on a lot of very subtle bugs and never questioned their desire to deliver the best software possible. Parent comment, however, talks about a situation where you have to hire dozens (if not hundreds) of $10/hour developers to ship software that is just good enough. I mean folks who may be great people and des…

Before rust started being used in crypto, rust salaries weren't great - probably targeting people happy to get less money to use their favourite language

Re: I want off Mr. Golang’s Wild Ride (2020)

#318
post #303

Earlier quoted context omitted.

The counterpoint is "your filenames shouldn't be badly-encoded unicode." In other words, "If `ls` can't render it, it's a bad filename. Rename the file." (This does mean that Go is constraining the set of problems it's easy to solve with it. But that's the nature of programming in general... We decide what problems need to be easier to solve at the expense of putting some problems outside the "sweet spot" and requiri…

If `ls` can't render a filename that is legal under the POSIX specs, there are two possibilities: - `ls` is wrong and should be fixed. - The specs are wrong and should not allow filenames to be arbitrary bytesequences. The third option ("The user is wrong even though they did exactly what was in the spec") is just unsatisfactory because it self-contradicts.

Specs are a three-edged sword: the spec, the intent, and the implementation.

And "The user is wrong even though they did exactly what was in the spec" is pretty much the rule, not the exception.

Re: I want off Mr. Golang’s Wild Ride (2020)

#319
post #17

Everything is a question of tradeoffs. I have to deal with cross-platform Go code on a small project at work. The requirements are modest and the Windows file system code is mostly for developer testing. The production system is Linux. Yes, it's sometimes not pretty and Go was clearly designed for Posix style file systems. We chose Go is that it is fairly high level, it gets the job done, and we don't have to worry a…

Engineering is the art of compromise.

The compromises I make to work in Go are easily paid off in what Go allows me to do and for the amount of effort it requires. Language wars are silly.

Re: I want off Mr. Golang’s Wild Ride (2020)

#320
post #71

WTF is going on in this thread? How did we become so sensitive, Haskell has had a lot of criticisms here at HN, never saw any flags/downvotes. People argued vehemently but without any animosity. Maybe something to be learned here https://youtu.be/iSmkqocn0oQ

it's probably the fourth time this article has been posted and people are tired of it
Post reply on HN