Live data from Hacker News

Were multiple return values Go's biggest mistake?

herecomesthemoon.net

11–20 of 25 posts

Re: Were multiple return values Go's biggest mistake?

#11
post #7
post #6

Not at all, if anything multiple return values offers such flexibility that it should be the default.

Did you read the article?

What was wrong with his proposition, things like range could be made to handle it or whatever. What's your point?

Re: Were multiple return values Go's biggest mistake?

#12

According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry: either a function receives a single input value, and returns a single output value, or it may receive multiple values and return multiple values, any other combination is problematic. The only advantage to multiple inputs - single output, is that it's resembling the math notation, but it also inherit…

> According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry

I'm not sure you can say that. You might be the only one surprised by multiple inputs single output.

Re: Were multiple return values Go's biggest mistake?

#13
post #12

According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry: either a function receives a single input value, and returns a single output value, or it may receive multiple values and return multiple values, any other combination is problematic. The only advantage to multiple inputs - single output, is that it's resembling the math notation, but it also inherit…

> According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry I'm not sure you can say that. You might be the only one surprised by multiple inputs single output.

What's more predictable: symmetry or assymetry?

Why there is so much symmetry in our world (Nature)?

Re: Were multiple return values Go's biggest mistake?

#14

Another thing that bugs me: if you have a function argument then it is copied by value, right? But it is hard to tell if the whole value is copied or not. - structures argument: the whole structure is copied (unless you passed a pointer to the struct) - interface? depends if the implementation is structure or pointer. - maps: it copies just a small internal struct that is pointing to the implementation of the map. -…

This is fairly standard and expected behaviour. Embedded pointers get copied only when you explicitly do a deep copy.

Re: Were multiple return values Go's biggest mistake?

#15
post #12

Earlier quoted context omitted.

> According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry I'm not sure you can say that. You might be the only one surprised by multiple inputs single output.

What's more predictable: symmetry or assymetry? Why there is so much symmetry in our world (Nature)?

I’m not sure what the name for this fallacy is. Appeal to unrelated concept?

Among the first functions children learn are things like addition of two numbers which lack this supposedly natural property.

Re: Were multiple return values Go's biggest mistake?

#16

Earlier quoted context omitted.

What's more predictable: symmetry or assymetry? Why there is so much symmetry in our world (Nature)?

I’m not sure what the name for this fallacy is. Appeal to unrelated concept? Among the first functions children learn are things like addition of two numbers which lack this supposedly natural property.

IMO you mistaken math-like infix notation with the number of arguments function receives.

  Tuple(Number,Number) -> add -> Number|Overflow

Re: Were multiple return values Go's biggest mistake?

#17
post #12

Earlier quoted context omitted.

> According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry I'm not sure you can say that. You might be the only one surprised by multiple inputs single output.

What's more predictable: symmetry or assymetry? Why there is so much symmetry in our world (Nature)?

Depends how you imagine a function. Just imagine it like a funnel. Your argument is honestly at the very least irrelevant.

Re: Were multiple return values Go's biggest mistake?

#18

According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry: either a function receives a single input value, and returns a single output value, or it may receive multiple values and return multiple values, any other combination is problematic. The only advantage to multiple inputs - single output, is that it's resembling the math notation, but it also inherit…

def add(a: int, b: int) -> int: return a + b

is this surprising to you ?

Re: Were multiple return values Go's biggest mistake?

#20

According to The Principle of Least Surprise (Principle of Least Astonishment, POLA)[1] there is should be a symmetry: either a function receives a single input value, and returns a single output value, or it may receive multiple values and return multiple values, any other combination is problematic. The only advantage to multiple inputs - single output, is that it's resembling the math notation, but it also inherit…

def add(a: int, b: int) -> int: return a + b is this surprising to you ?

Yes, since I was a kid.

My first real computer was an RPN calculator.

Also one of my first programming textbooks back then used an educational PL which allowed multiple return values (late 80s).

I think in terms of data flows and circuits, so it’s natural for me.

Post reply on HN