Liste des Groupes | Revenir à cl c |
On 08.11.2024 19:18, David Brown wrote:On 08/11/2024 18:37, Janis Papanagnou wrote:
Sure, I appreciate all this. We must do the best we can - I am simply saying that using | for this operation is far from the best choice.The language here is "mathematics". I would not expect anyone who evenMathematics, unfortunately, [too] often has several symbols for
considers designing a programming language to be unfamiliar with that
symbol.
the same thing. (It's in that respect not very different from
programming languages, where you can [somewhat] rely on + - * /
but beyond that it's getting more tight.)
Programming languages have the additional problem that you don't
have all necessary symbols available, so language designers have
to map them onto existing symbols. (Also Unicode in modern times
do not solve that fact, since languages typically rely on ASCII,
or some 8-bit extension, at most; full Unicode support, I think,
is rare, especially on the lexical language level. Some allow
them in strings, some in identifiers; but in language keywords?)
BTW, in Algol 68 you can define operators, so you can defineWe are - unfortunately, perhaps - constrained by common keyboards and ASCII (for the most part). "v" and "^" are poor choices for "or" and "and" - "∨" and "∧" would be much nicer, but are hard to type. For better or worse, the programming world has settled on "|" and "&" as practical alternatives. ("+" and "." are often used in boolean logic, and can be typed on normal keyboards, but would quickly be confused with other uses of those symbols.)
"OP V" or "OP ^" (for 'or' and 'and', respectively, but we cannot
define (e.g.) "OP ·" (a middle dot, e.g. for multiplication).[*]
>Well, I'm more used (from mathematics) to 'v' and '^' than to '|'The detail of what symbols are used is>
not that important to me, if it fits to the overall language
design.
I am quite happy with the same symbol being used for very different
meanings in different contexts. C's use of "*" for indirection and for
multiplication is rarely confusing. Using | for "bitwise or" and also
using it for a "pipe" operator would probably be fine - only one
operation makes sense for the types involved. But here the two
operations - "bitwise or" (or logical or) and "choice" can apply to to
the same types of operands. That's what makes it a very poor choice of
syntax.
and '&', respectively. But that doesn't prevent me from accepting
other symbols like '|' to have some [mathematical] meaning, or
even different meanings depending on context. In mathematics it's
not different; same symbols are used in different contexts with
different semantics. (And there's also the mentioned problem of
non-coherent literature WRT used mathematics' symbols.)
Opinions can be justified, and that discussion can be interesting. Purely subjective opinion is less interesting.>Actually, while I like Algol 68's flexibility, there's in some
(For comparison, Algol 68 uses "OR", "∨" or "\/" for the "or" operator,
thus it does not have this confusion.)
cases (to my liking) too many variants. This had partly been
necessary, of course, due to the (even more) restricted character
sets (e.g. 6-bit characters) available in the 1960's.
The two options for conditionals I consider very useful, though,
and it also produces very legible and easily understandable code.
Well, on opinions there's nothing more to discuss, I suppose.[...]>
I've nothing (much) against the operation - it's the choice of operator
that is wrong.
Les messages affichés proviennent d'usenet.