Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Peng Zang <peng.zang@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Adding methods to an object
Date: Fri, 23 Nov 2007 08:41:51 -0500	[thread overview]
Message-ID: <200711230842.04448.peng.zang@gmail.com> (raw)
In-Reply-To: <200711171443.59672.jon@ffconsultancy.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Jon,

I was hoping someone else would answer your question and enlighten me as well, 
but that doesn't appear to be happening.  Sooo, here's my .02

I don't think there's an easily way to do this for an arbitrary object.  The 
main problem being the difficulty with ensuring that the return object has 
the same methods as the original (plus some others).  That would require 
inheritance at an object level as opposed to class level.

Alternatively if one knew how messages to objects happen, one could create a 
wrapper object to provide the new methods and passthrough any messages it 
doesn't recognize.  But I have no idea how the internals of messaging 
happens.

Peng



On Saturday 17 November 2007 09:43:59 am Jon Harrop wrote:
> Given an object that provides a variety of methods, how do you create an
> return an object that augments the given object with more methods?


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHRtisfIRcEFL/JewRAtu3AKCX4EsMl2voDuUlg49X78uM0ZgPiQCeMHBt
7K3oParomxx8Td4ewoa3u/4=
=Z9Zz
-----END PGP SIGNATURE-----


      reply	other threads:[~2007-11-23 13:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-17 14:43 Jon Harrop
2007-11-23 13:41 ` Peng Zang [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=200711230842.04448.peng.zang@gmail.com \
    --to=peng.zang@gmail.com \
    --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