caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: rathereasy@gmail.com
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] adding methods to object
Date: Tue, 01 Apr 2008 15:33:53 +0900 (JST)	[thread overview]
Message-ID: <20080401.153353.71907522.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <f74178430803312250n5b9b88fbg73a7342575ccd221@mail.gmail.com>

From: "Jacques Le Normand" <rathereasy@gmail.com>

> is it possible to add methods to an object?
> in other words, if an object has type <a:b,c:d>, is it possible to create an
> object of type <a:b,c:d,e:f> ?

No, you can only add methods to classes.
The only thing you can do with an object is build a wrapper object or
class, which forwards original methods to the base object:

let wrap o =
  object
    method a = o#a
    method c = o#c
    method e = ...
  end

Jacques Garrigue


      reply	other threads:[~2008-04-01  6:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01  5:50 Jacques Le Normand
2008-04-01  6:33 ` Jacques Garrigue [this message]

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=20080401.153353.71907522.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@yquem.inria.fr \
    --cc=rathereasy@gmail.com \
    /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).