Timeline for When should tuples be used as an argument instead of an array?
Current License: CC BY-SA 4.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 26, 2023 at 21:11 | vote | accept | dve.exe | ||
| Jul 5, 2023 at 23:57 | answer | added | Ewan | timeline score: 1 | |
| Jul 5, 2023 at 23:26 | comment | added | Ewan | well if you are going to be lazy there is dynamic ;) | |
| Jul 5, 2023 at 20:56 | comment | added | gnasher729 | Ewan, can’t agree. Lazy is good. | |
| Jul 5, 2023 at 20:54 | comment | added | gnasher729 | @Rik Tuples are often used as ad hoc structs. Unless you have a reason why you want a type with its own name creating a class is pointless. On the other hand, just passing individual parameters may be just fine. Tuples as return values are more useful because you can only return one value. | |
| Jul 5, 2023 at 15:22 | comment | added | dve.exe | @Alexander I updated the OP for clarification. | |
| Jul 5, 2023 at 15:18 | history | edited | dve.exe | CC BY-SA 4.0 | added 635 characters in body |
| Jul 5, 2023 at 11:16 | comment | added | Aluan Haddad | I don't know that Swift allows you to declare fixed length arrays. If you may not, then I would say the array option is by far the least maintainable and readable. While tuple a would be superior in this case, it is only slightly better when all elements are of the same type | |
| Jul 4, 2023 at 13:45 | comment | added | Alexander | Can you elaborate more on how they're being compared, and what the significance of these 3 cards is in your program? | |
| Jul 4, 2023 at 8:03 | comment | added | guillaume31 | If this group of cards has a name in your business domain, it probably deserves a class @David. If it doesn't but the 3 cards have a name individually, tuple or array are not the best choice, just use 3 parameters. | |
| Jul 4, 2023 at 4:21 | answer | added | J_H | timeline score: 1 | |
| Jul 3, 2023 at 21:31 | answer | added | candied_orange | timeline score: 3 | |
| Jul 3, 2023 at 19:42 | comment | added | Ewan | The general rule is to avoid tuples, they are lazy | |
| Jul 3, 2023 at 18:40 | review | Close votes | |||
| Jul 8, 2023 at 3:01 | |||||
| Jul 3, 2023 at 17:57 | answer | added | mmathis | timeline score: 3 | |
| Jul 3, 2023 at 17:48 | comment | added | dve.exe | True, that's another option. I guess the reason I didn't consider that is that in this specific case is, would it merit creating a class for this one function call/comparison? My thought is no, but I definitely could be wrong. | |
| Jul 3, 2023 at 17:35 | comment | added | Rik D | 4. Create a class for this type with three properties for cards and give this class a meaningful name. | |
| S Jul 3, 2023 at 17:29 | review | First questions | |||
| Jul 3, 2023 at 19:22 | |||||
| S Jul 3, 2023 at 17:29 | history | asked | dve.exe | CC BY-SA 4.0 |