Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
SoldierOfCode1867238dWell, probably for the names I assume.
{name: "dog", age: 7, weight: 26} is clearer/easier to work with than ("dog", 7, 26) -
Lensflare19721238dDepends on the language but normally structs are named. Tuples are anonymous.
If you want to refer to the same type in multiple places, you probably want to use a struct and refer to its name instead of repeating the tuple definition.
Also, structs can have more stuff like methods/functions, nested types, static properties, etc. Tuples can not have this. -
Lensflare19721238dOne more thing to consider:
Tuples have either value or reference semantics, it depends on the language.
So for example if the tuples in your language have reference semantics and you want value semantics, you probably want to use struct (which has value semantics in most languages). -
12bitfloat10418238dBecause the world isn't black and white
Sometimes a little nuance goes a long way -
Ranchonyx10406238dIdgaf.
You can do it any way you like, it doesn't matter. It's a stupid debate. -
lungdart3429237d@Ranchonyx yup.
I prefer whatever way is the most readable/understandable. And you could argue one over another in all sorts of situations.
why structs/objects when can tuples everything
random
tuples