You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 3863 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Frederic Loulergue
Version: all
OS: Linux
Submission from: 193.49.83.4 (193.49.83.4)
Ocaml Manual indicates that :
~-3 could be written -3
~-3 could be written -.3
but -3. is accepted and evaluated to -:float = -. 3.
If it is not a bug it is an ugly feature
The text was updated successfully, but these errors were encountered:
Ocaml Manual indicates that :
~-3 could be written -3
~-3 could be written -.3
No. ~- and ~-. are prefix operators. When - and -. are used as prefix
operators
(instead of infix), the parser converts them to ~- and ~-. respectively.
This means that (- x) is the same as (- x),
and (-. x) is the same as (-. x).
but -3. is accepted and evaluated to -:float = -. 3.
Constants are another matter. -3. is a floating-point constant, not
the application of unary negation to a number. You see the difference when
using it in a pattern:
fun (-3.) -> true;; <- this works
fun (-~. 3.) -> true;; <- this doesn't work
If it is not a bug it is an ugly feature
The ugliness is in mathematics: using the same identifier for two different
functions: subtraction and negation. We are only propagating this ugliness
because of the principle of least astonishment.
Original bug ID: 3863
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Frederic Loulergue
Version: all
OS: Linux
Submission from: 193.49.83.4 (193.49.83.4)
Ocaml Manual indicates that :
~-3 could be written -3
~-3 could be written -.3
but -3. is accepted and evaluated to -:float = -. 3.
If it is not a bug it is an ugly feature
The text was updated successfully, but these errors were encountered: