caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* adding methods to object
@ 2008-04-01  5:50 Jacques Le Normand
  2008-04-01  6:33 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 2+ messages in thread
From: Jacques Le Normand @ 2008-04-01  5:50 UTC (permalink / raw)
  To: caml-list caml-list

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

hello caml-list
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> ?

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] adding methods to object
  2008-04-01  5:50 adding methods to object Jacques Le Normand
@ 2008-04-01  6:33 ` Jacques Garrigue
  0 siblings, 0 replies; 2+ messages in thread
From: Jacques Garrigue @ 2008-04-01  6:33 UTC (permalink / raw)
  To: rathereasy; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-01  6:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-01  5:50 adding methods to object Jacques Le Normand
2008-04-01  6:33 ` [Caml-list] " Jacques Garrigue

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).