Post Reply 
RPL equivalents to BREAK, CYCLE, EXIT, etc.?
06-09-2014, 04:24 PM
Post: #17
RE: RPL equivalents to BREAK, CYCLE, EXIT, etc.?
(06-09-2014 09:12 AM)HP67 Wrote:  ...

There's no question that Thomas' example is tightly coded and efficient. I doubt a UserRPL version could be created that is smaller or faster.

I've already stated that clarity and readability is subjective. From my perspective, Thomas' version is less clear for the reasons I gave. Coming back to both of these a couple years from now, I would have to spend a little more time understanding what his was doing. I don't understand your error-prone assessment, but that's also a more subjective area.

Before I even responded to Thomas, I realized that he intentionally chose an example that was biased toward using something like a BREAK. His example is small enough that having multiple exit points isn't particularly risky. But I still believe it makes a good example of a piece of code that works less by the design of language constructs and more by artifacts of the specific mechanisms employed. Generally speaking, code written in that way is more fragile, less portable, and more likely to encounter problems as updates to software occur later.

I'm not suggesting that the version I submitted is "more correct". It's simply a translation with a different focus (as requested). A more realistic approach to coding should always attempt to strike a balance between the competing goals of space, time, and clarity. The best mix will depend on the specific problem.

"Life is short and ROM is full", and handheld devices historically haven't afforded lots of breathing room for programmers. That has caused a heightened scrutiny of code size and speed, but I believe that we've left clarity behind far more often than we should. Programmers tend to value cleverness in themselves, but they complain quite loudly when others have employed it too often in code they're trying to maintain (and with good reason).

Sometimes, that "other programmer" is yourself, 2 months/years/decades later. Smile I suppose that's my motivator for promoting a healthier balance in coding styles.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: RPL equivalents to BREAK, CYCLE, EXIT, etc.? - DavidM - 06-09-2014 04:24 PM

User(s) browsing this thread: 1 Guest(s)