caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Steffen Smolka <smolka@cs.cornell.edu>
To: <caml-list@inria.fr>
Subject: [Caml-list] namespace inside object?
Date: Thu, 9 Feb 2017 15:36:11 -0500	[thread overview]
Message-ID: <CAGh2ivAw17fXw_iR4bBPzsK4jXOmrmcYka0HJE77rS+vkcBwVg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 807 bytes --]

             reply	other threads:[~2017-02-09 20:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09 20:36 Steffen Smolka [this message]
2017-02-09 22:55 ` Jeremy Yallop
2017-02-09 23:19   ` Steffen Smolka
2017-02-09 23:37     ` Gerd Stolpmann
2017-02-09 23:54       ` Steffen Smolka
2017-02-10  2:01         ` Yaron Minsky
2017-02-10  3:16           ` Steffen Smolka
2017-02-10  3:32             ` Yaron Minsky
2017-02-10  9:38             ` Leo White
2017-02-10 14:40               ` Evgeny Roubinchtein
2017-02-10 15:16                 ` Markus Mottl
2017-02-10 15:49                 ` Leo White

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGh2ivAw17fXw_iR4bBPzsK4jXOmrmcYka0HJE77rS+vkcBwVg@mail.gmail.com \
    --to=smolka@cs.cornell.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).