Live data from Hacker News

"14 Years of Go" by Rob Pike

codereliant.io

51–60 of 75 posts

Re: "14 Years of Go" by Rob Pike

#51
post #17

Lack of support for operator overloading is a bit sad. As a result, Go can't get used in numerical applications, unless you like writing `matrix_plus(A, B)` instead of `A + B`. Is there a programming language that has a "simple" design like Go but which supports some operator overloading?

>unless you like writing `matrix_plus(A, B)` instead of `A + B`.

I am.

Also, this would be trivial with a DSL and a preprocessor, so...

Re: "14 Years of Go" by Rob Pike

#52

Earlier quoted context omitted.

Adding matrices with A+B looks nice. But then you'll soon want to do A*B+C, and you'll find that fused multiply/add is a much faster operation than doing a multiplication and then addition, and soon you'll either be writing mul_add(A, B, C) anyway, or you'll overengineer a complex solution to make A*B return some kind of object that can recognize the subsequent + operation etc. Update: corrected * representation

You can have your cake and eat it. E.g. C++ expression templates allow you to fuse application of multiple operators.

>You can have your cake and eat it

Yes, but it's C++, so the cake has 200 ingredients, a 1000 step recipe (the majority of which steps are deprecated and have newer alternatives), tastes bland, and takes days in the oven.

Re: "14 Years of Go" by Rob Pike

#53
post #19

Earlier quoted context omitted.

I know C, python, Go and Rust reasonably well and Go is usually my default choice for a new projects. Well unless it's just a quick script, in which case Python will do just fine. Tried Scala while learning Chisel and hate it from the bottom of my heart. It's like Kotlin on bad drugs. My point is, people are different.

> Well unless it's just a quick script, in which case Python will do just fine. Weirdly Go has made me enjoy Python even less and compilation is so fast it's turned into my go-to for quick "scripts."

For anything under the "analysis of data" heading, a REPL borders on essential. So many of my quick scripts are ideas I have that involve taking some freely available data and turning it into something else. Some of the steps in this process can take minutes (rarely, hours). You don't necessarily want to save every intermediate product of your work, and you don't want to have to rerun the program from the top every time you change a line. REPLs solve this problem in a way that is really great to work with.

They also solve the problem of needing to hold the standard library in your head. When I'm working in Python, and I can't remember if the method to check whether a string has a particular prefix is `beginswith` or `startswith`, if I'm working in a REPL it's just a tab-complete away. In a language without a REPL, the solutions are "look it up online", "try both and see what works", and "you are using an IDE, right? RIGHT?"

Re: "14 Years of Go" by Rob Pike

#54
post #4

Earlier quoted context omitted.

To be honest. That doesn't invalidate their opinion. Both can be true.

Scala is a bit of a journey in intellectual masturbation. Rust is complicated as a side effect of safety I feel. It's not trying to be smart but it appears that way for safety and zero cost abstractions.

Depends. Scala can be used as "Java+" with heavily relying on OOP and side-effects, it isn't like Haskell where FP is the hard default.

Rust is actually a very well designed language that takes the best ideas from FP (e.g. error/null handling wtih ADTs) where something like Go is stuck in the 80s without any sensible reason as to why.

The borrow checker and everything related to it is another matter but it actually solves the biggest hurdle in using e.g. C or C++ which are memory related bugs without any additional performance costs like with a garbage collector.

Re: "14 Years of Go" by Rob Pike

#55
post #22

Earlier quoted context omitted.

I'm really not a fan of small qol features like this. I think it really hurts readability for the general audience. The function itself is minimal overhead and is clearer to the reader.

That's true, we should get rid of operators for primitives too.

In better languages they don't exist except as sugar, they're functions themselves.

Re: "14 Years of Go" by Rob Pike

#56

Earlier quoted context omitted.

Adding matrices with A+B looks nice. But then you'll soon want to do A*B+C, and you'll find that fused multiply/add is a much faster operation than doing a multiplication and then addition, and soon you'll either be writing mul_add(A, B, C) anyway, or you'll overengineer a complex solution to make A*B return some kind of object that can recognize the subsequent + operation etc. Update: corrected * representation

You can have your cake and eat it. E.g. C++ expression templates allow you to fuse application of multiple operators.

How can you? Genuinely asking. You can overload operator + or operator *, but how could you make a dedicated ternary (three-way) operator that combines those two operations into something like std::fma? I guess you could overload the function call operator, but that doesn't offer much over just defining a function.

Re: "14 Years of Go" by Rob Pike

#57

Earlier quoted context omitted.

You can have your cake and eat it. E.g. C++ expression templates allow you to fuse application of multiple operators.

Plenty of people are choosing Go because they neither have nor want the C++ cake. The OP was explicitly looking for a simple language, and C++ is the very opposite of that concept. So yes, you can have efficient nice abstractions, but only at the cost of an extraordinarily complex base language.

My point was that operators don't exclude the possibility of fusion. C++ expression templates were just an example. Numba does fusion in Python.

Re: "14 Years of Go" by Rob Pike

#58
post #18

[dead]

> Performance is good enough, it's not the intellectual masturbation of Scala or Rust. As we know, any technology that would require experienced programmers to learn something is a crime against engineering.

I've used scala and erlang professionally; I have nothing against learning new languages.

My comment was not really meant as seriously as the commenters here are taking it (I really didn't mean to infer anything about users of those..) -- but I also sort of stand by it -- I spent lots of time in stupid meetings about language features when I used those languages that I would have rather avoided.

It's of course not the languages fault, and more likely a smell of an org problem at wherever it was I was working back then (201x's).

It's completely true that I don't know rust; I tried, and $dayjob does use it for some components but it seems to be really overloaded with syntax and symbols to me -- then again I'm a dinosaur who started on C and maybe I'm just getting old....

Re: "14 Years of Go" by Rob Pike

#59
post #17

Lack of support for operator overloading is a bit sad. As a result, Go can't get used in numerical applications, unless you like writing `matrix_plus(A, B)` instead of `A + B`. Is there a programming language that has a "simple" design like Go but which supports some operator overloading?

Zig also does it this way and I think it makes sense. Operator overloading gives the same symbols different semantic meaning in different contexts. This hurts readability and simplicity.

Re: "14 Years of Go" by Rob Pike

#60
post #14

Earlier quoted context omitted.

I was with you until you slagged on the other options. Rust and Scala are designed for other use cases than yours. That doesn’t trivialize their worth.

> Rust and Scala are designed for other use cases than yours This has become a sort-of gotcha for any discussions that involve comparing programming languages, but I think it has been over-extended beyond what is reasonable. It is true that some languages are much better at certain use cases than others, and especially if you consider their ecosystems when making this determination. For example, I don't feel Go makes…

[dead]
Post reply on HN