|
|
|
|
|
by yawaramin
2488 days ago
|
|
That is by design. OCaml philosophy has been to be explicit about code. It's very Go-ish in that sense. So for example integer and float operators are different: let int3 = int1 + int2
let float3 = float1 +. float2
However OCaml does allow operator redefinition and shadowing, so you can redefine and use any operators you want just by opening their specific modules (local opens, i.e. module opens that last for the scope of a single expression, are preferred): let int3 = Int.Ops.(int1 + int2)
let float 3 = Float.Ops.(float1 + float2)
Note: the above modules Int.Ops and Float.Ops are for illustration purposes only, they don't exist in the standard library. You could write them pretty easily, though. |
|