4 ms·
Well, you also have to consider greater debugging costs of you use a loop comprehension. Expression of intention isn't the only issue to consider.
by seanmcdirmid 11y ago
Well, you also have to consider greater debugging costs of you use a loop comprehension. Expression of intention isn't the only issue to consider.
- TeMPOraL 11y agoI disagree - debugging costs usually come directly from choosing a construct that does not express programmer's intentions (like using a naked for when foreach would be more adequate - or, conversely, by messing with conditionals inside loop body when putting the condition in the loop header would be more adequate).
- seanmcdirmid 11y agoDebugging a higher order function application is harder than stepping through a loop, at least in most debuggers I've used. I use them only when the logic called indirectly is not complicated to require much debugging (and I still wind up converting comprehensions into loops because they are too much trouble).
- TeMPOraL 11y agoOh ok, I can imagine more complex expressions being harder to debug from machine code level. That said, I rarely if ever have to resort to low-level debugging in such cases. I'm yet to encounter a problem that couldn't be solved by looking at the code and (very occasionally) stepping it through in the debugger. Here, using higher-order constructs in code is actually very helpful - the closer your code gets to expressing your intent, the smaller the set of possible bugs is. For instance, you can't make an off-by-one error in a foreach or a mapcar.
- seanmcdirmid 11y agoThere are many other things to debug beyond the basics. I admire those people who can do all the computer simulation in their head, but many of us want good debugging support, ever since the mid 90s (well, it really started with Microsoft's CodeView in the late 80s). PL abstractions should consider that in their designs, not just elegant conciseness. Code isn't just read.