In OCaml, the infix operators or
and &
are defined as synonyms for ||
and &&
, resp. I like the first group of operators because they are a little easier to type, and they make me think I'm learning something different from conventional languages.
Unfortunately, both or
and &
are marked as deprecated in the manual. I'd like to know
If the designers of OCaml have wrote a rationale for this design decision, I'd like to know where it is located. I'd appreciate for your help.
As a side note, here's what I thought:
Argument 1 . ||
and &&
are more friendly to former programmers of C and its descendants.
Counter-argument 1 . OCaml is in few ways similar to C. It makes little sense to make it look like C in this particular regard only.
Argument 2 . It is more desirable to have similar symbols for both conjunction and disjunction.
Counter-argument 2 . In natural languages, we only had a special symbol, &, for conjunction and not for disjunction, and we were happy with that for centuries. Besides, some textbooks in logic, including Mathematical Logic by Shoenfield, use entirely different symbols for disjunction and conjunction, viz., & and ∨.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.