Is it possible to create namespaces inside an object? Concretely, I would like to write

class buffer = object(self)
  ...
  method get = ...
  
  module Latin1 = struct
    method get = ...
  end

  module Utf8 = struct
    method get = ...
  end
end

so that given an object b : buffer, I can call methods
b#get
b#Latin1.get
b#Utf8.get

Declaring modules inside an object seems to be illegal, though. Is there any way to achieve something along those lines? Is there a better way to structure things?

Thanks,
-- Steffen