mark at livecode.com
Wed May 24 12:55:36 EDT 2017
On 2017-05-24 18:44, Mark Wieder via use-livecode wrote:
>> As I said before, the lack of switch in LCB isn't because we don't
>> a construct like that; just that we'd like one which doesn't have the
>> issues of C-style switch. (The best way to avoid people accidentally
>> introducing subtle bugs, is to ensure the language is designed to not
>> let them do so!)
> It's *always* possible to introduce bugs, subtle or not. The best way
> to avoid that is not to allow people to code <g>
Hehe - well that is certainly true - no one can argue with that!
Of course it is always possible to introduce bugs, but when you have
a control structure with a syntax which is almost begging for people
to make mistakes with it - surely it is worth considering how it could
be restructured to prevent that?
Indeed, the evidence that there is a problem here is held up by the
fact that more recent C compilers have explicit warnings which tell you
potential errors in your switch statements - indeed, IIRC, there is even
a way to mark *explicit* fall-through in recent GCC or clang so that
you don't get a warning (which is important if you compile your code
with warnings-as-errors - we've started to turn more and more warning
flags into errors on our codebase to make sure that we don't introduce
the errors they warn about).
Generally compiler writers aren't going to spend time adding warnings
for things which *aren't* a common problem in end-user code - there's
far too many other fish to fry. So I generally think that if something
language design requires compiler writers to add explicit warnings
about potential problems in a construct then it suggests the construct
is perhaps not as good as it could be.
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the Use-livecode