Black Hole
May contain traces of nut
That's where I think people who are submerged in any particular sphere lose sight of how things look from outside that sphere. Yes, it may well be "standard" amongst programmers, but if you wanted to be explicit it would be (something like)No, it's explicitly by design and common across many programming languages. Take the following example from C
Code:If (val && strlen(val))
That's something you'll see in pretty much every C program. Calling strlen with a null argument would crash the program. The fact that the strlen call is not done if val is false is absolutely essential.
Code:
If (val != "") then strlen(val) else 0
If (val && strlen(val)) only makes sense if you know that the particular target language assumes an undefined variable evaluates to FALSE when pulled into a logical condition, that the optimiser prevents evaluation of irrelevant terms, and that it's OK to not have an implied THEN following an IF.
Self-documenting code should be comprehensible even when one is not familiar with the language. One can read code with a lot less knowledge than it takes to write (working) code, but it helps if the intention is explicit and not implied.To those familiar with the language, it's as clear as any other construct.
This is not meant to start an argument, it's just to point out there are other ways of looking at it.
Last edited: