Re:Were multiple return values Go's biggest mistake?
by rat9988 on Saturday March 15, 2025 @02:58PM
(#43374473)
> 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?
by nivertech on Saturday March 15, 2025 @03:01PM
(#43374495)
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?
by semiquaver on Saturday March 15, 2025 @03:15PM
(#43374579)
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?
by nivertech on Saturday March 15, 2025 @03:44PM
(#43374750)
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?
by rat9988 on Saturday March 15, 2025 @03:57PM
(#43374816)
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?
by joeyagreco on Saturday March 15, 2025 @03:58PM
(#43374822)
def add(a: int, b: int) -> int:
return a + b
is this surprising to you ?
Re:Were multiple return values Go's biggest mistake?
by nivertech on Saturday March 15, 2025 @04:08PM
(#43374855)
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.
The only advantage to multiple inputs - single output, is that it's resembling the math notation, but it also inherits all of its shortcomings, and obviosly it wasn't designed with computers in mind.
Same with function taking or returning 0 values (e.g. void).
Function receiving 0 inputs should be a constant.
Function returning 0 outputs, is a procedure with a side-effect, and should be implemented using a different construct.
---
1. https://en.wikipedia.org/wiki/Principle_of_least_astonishmen...