Hi Steffen,

Your question contains the answer :) You can indeed expose an object type and a class type without exposing the class.

module Example : sig 
  class type t = object
      method print : unit
    end 
end = struct 
    class t = object
      method print = print_endline "yep"
    end 
  end

The class implementation will not be exposed, so `new Example.t` will say `Unbound class Example.t`. But, the class type and object type will be exposed,
e.g, you may say `type printable = Example.t` (yes, class type declaration declares both the type and the class type).

Regards,
Ivan


On Mon, Feb 13, 2017 at 1:23 PM, Steffen Smolka <smolka@cs.cornell.edu> wrote:
Hi,

Is it possible to expose an object or class type in OCaml without exposing the constructor, i.e. the ability to construct objects of the type? OCaml supports private ADTs and type synonyms, but the private keyword doesn't seem to work with classes or objects.

Thanks,
-- Steffen