|
|
|
|
|
by bheadmaster
1358 days ago
|
|
You are right. Now that I've had more time to think about it, I think the problem of Python-like tuples in Go is that they require Pythonesque everything-is-a-reference paradigm in order to function the same way, otherwise they just act as heterogenous arrays in Go (which exist as arrays of empty interfaces, with a slight runtime cost). Go is mainly value-oriented language like C, with the exception of built-in container types and strings (and maybe a few others that slipped my mind). I suppose that adding fixed-type pass-by-value tuples would essencially be reimplementing struct. Go doesn't like duplicating functionality. |
|
Whether to pass by reference or value and other design decisions should probably be taken (as much as practicable) from the design decisions for structs in your language.