3 ms·
> Such things are quantifiable. We can have an exact rule which says that you can use an ad-hoc list as a structure if (for instance): So what happens when you
by joshuamorton 6y ago
> Such things are quantifiable. We can have an exact rule which says that you can use an ad-hoc list as a structure if (for instance):
So what happens when you have a datum that is used in exactly 17 functions, but you need to add another feature?
Or, what happens when people combine functions into larger ones to avoid having to define a real datatype, or...
These concerns exist for each thing.
"Don't use a list where you really have a struct" is much more concrete and quantifiable.
- kazinator 6y ago> but you need to add another feature? You have to add your feature in such a way that the resulting code meets the rules. It's exactly the same like when you need to add something to a line that is already 79 characters long (maximum allowed by your coding convention). Or if you have to add lines of code into a function that is already 200 lines long (coding style max). Or if you need another argument in some API that already has the maximum of 8. You have to step back to some extent and change more of the surrounding program, than just shoving your intended change into it. > Or, what happens when people combine functions into larger ones to avoid having to define a real datatype If the code remains under the quantified limit for function size, then it is complying with the document. > "Don't use a list where you really have a struct" is much more concrete and quantifiable. There are two answers to "where do you really have a struct?" One is purely opinionated, and one is objective. The objective answer is: "you really have a struct in all situations where the list isn't a variable length container of items of the same type". So the concrete and quantifiable (and therefore the right) interpretation of the rule amounts to never using a fundamentally characteristic Lisp technique, in Lisp!