caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Question about objects and method overriding
@ 2014-02-02 11:55 Tom Ridge
  2014-02-02 12:43 ` Jacques Garrigue
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tom Ridge @ 2014-02-02 11:55 UTC (permalink / raw)
  To: caml-list

Dear caml-list,

With records, one can functionally update a field e.g. as

{ r with some_field=new_value }

And new_value may, of course, be a function.

With objects, is there similar functionality? e.g. can I write something like

{{ myobj with method some_method=new_method }}

?

Of course, I could copy the methods from myobj explicitly into a new
object (and set some_method to new_method), but I might not know all
the methods available on myobj, and even if I do this becomes
textually extremely verbose.

Of course, new_method cannot directly refer to self etc. Basically I
am using objects in a similar way to records, and would like to use
this functional record update feature.

Thanks

Tom

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

end of thread, other threads:[~2014-02-05 18:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-02 11:55 [Caml-list] Question about objects and method overriding Tom Ridge
2014-02-02 12:43 ` Jacques Garrigue
2014-02-02 12:50   ` Tom Ridge
2014-02-03 10:35 ` Goswin von Brederlow
2014-02-03 12:24   ` Tom Ridge
2014-02-03 15:54     ` Goswin von Brederlow
2014-02-03 13:55   ` Alain Frisch
2014-02-03 15:12     ` Tom Ridge
2014-02-05 18:22 ` remy

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