Einzelnen Beitrag anzeigen

Benutzerbild von smallie
smallie

Registriert seit: 8. Jan 2013
19 Beiträge
 
Delphi 10.3 Rio
 
#35

AW: EMB DCE 12 - Bedingungen mit einen Assign-Zeichnen

  Alt 11. Okt 2024, 14:51
Niklaus Wirth schrieb vor einigen Jahren:

Zitat:
Good Ideas, Through the Looking Glass
IEEE Cover Feature 2006

It has become fashionable to regard notation as a secondary issue depending purely on personal taste. This could partly be true; yet the choice of notation should not be considered arbitrary. It has consequences and reveals the language’s character.

Choosing the equal sign to denote assignment is one notoriously bad example that goes back to Fortran in 1957 and has been copied blindly by armies of language designers since. This bad idea overthrows a century-old tradition to let = denote a comparison for equality, a predicate that is either true or false. But Fortran made this symbol mean assignment, the enforcing of equality. In this case, the operands are on unequal footing: The left operand, a variable, is to be made equal to the right operand, an expression. Thus, x = y does not mean the same thing as y = x. Algol corrected this mistake with a simple solution: Let assignment be denoted by :=.

This might appear as nitpicking to programmers accustomed to the equal sign meaning assignment. But mixing up assignment and comparison truly is a bad idea because it requires using another symbol for what the equal sign traditionally expresses. Comparison for equality became denoted by the two characters == (first in C). This is an ugly consequence that gave rise to similar bad ideas using ++, —, &&, and so on.

Published by the IEEE Computer Society 0018-9162/06/$20.00 © 2006 IEEE
"There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors."
  Mit Zitat antworten Zitat