by achamayou · 10y ago · 0 comments
D can arguably be mitigated by differentiating bitwise operators more them from their logical counterparts (for example by having the logical operators in plain English).
Many more are better handled at the editor/IDE level, but this seems like a really interesting read for anyone involved in PL design.
C broke BCPL syntax that was clear, memorable, and consistent and replaced it with a math-like syntax that must have wasted millions of person hours of debugging time in the decades since - for no good reason.
Similarly &(pointer address) and &&(logical and) are too close and too easy to typo.
Language design really should have considered human factors much more than it did.
Not to mention &(bitwise and).
if (x = y)
x += 10
end
(assign y to x and operate on x if x is truthy )The optional parens reminds me that this is a deliberate assignment. But as someone who now teaches Python, I thank the Python gods who disallowed such syntactic sugar. I've found it impossible to overestimate how difficult it is for beginners to grok "a = b"...and can you blame them, after years for math instruction telling them that that equals sign means something else? (Never mind the clusterfuck that occurs when trying to teach SQL -- which also uses singal equals sign for equality -- in tandem with a scripting language. The cognitive difficulty is so high that I've considered switching to teaching R, which at least has the optional arrow operator, "a <- b"