3 ms·
For all people who say good programmers don't make type errors, here's a counterexample.
by jganetsk 18y ago
For all people who say good programmers don't make type errors, here's a counterexample.
- pg 18y agoIt's an interesting question whether it's really a type error to mismatch the sizes of things. I feel like sometimes it is and sometimes it isn't.
- jganetsk 18y agoAgreed. But it sounded like, in this case, you were using a list to represent that which would have been represented by a record in a statically typed language. I'm imagining you'd have some kind of Field record type, with isDisplayable and isModifyable fields. Instead of destructuring as a list (or tuple), you would explicitly look for isDisplayable and isModifyable. But, of course, you could still make the same mistake in a statically typed language if you chose not to set up the data structure this way.
- KayEss 18y agoIn a strongly typed language one would normally want to reify the number in the type system whenever possible, i.e. the use of (a,b,c,d,e) rather than [a,b,c,d,e] in Haskell (that's a 5-tuple rather than a 5 element list). I think that people used to dynamic programming languages would normally pick the list rather than the tuple simply because it at first appears easier. I think Dijkstra had something to say on that particular subject :)