Hacker News new | ask | show | jobs
by pjmlp 2643 days ago
I guess it is the typical complain about using separate operators for ints and floats.

It never bothered me in Caml Light, let alone when Objective Caml was introduced.

2 comments

You can write floating point operators in several different ways. You can write with the normal floating point operators

    x *. y +. z
or, since `Float.(+) = (+.)`, `Float.() = (.)`, etc,

    let open Float in
    x * y + z
or simply

    Float.(x * y + z)
That is pretty neat. Does it mean that one could do something similar for vectors and quaternions?

    let open Quaternion in
    x * y + x
Yep. You could write

    module Quaternion = struct
      let (+) =
        ...
    
      let ( * ) =
        ...
    end
then

    let open Quaternion in
imports the contents of Quaternion into local scope, so you can write

    x * y + z
Yes.
Ah, maybe, perhaps I am in the minority that liked the different operators for ints and floats. :D