From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id AE2807FAF6 for ; Sun, 30 Nov 2014 16:49:34 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.17.10; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.17.10; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.17.10; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvIBAEw7e1TU4xEKnGdsb2JhbABbg1dYxnYGhlICgQgWAQEBAQERAQEBAQEGDQkJFC6EAwEBAwFVJAULC0ZXBhMJiC4NCdIPAQEBAQEBBAEBAQEBHYpLhgomB4I0U4FBBYYDi0oChQqFbodNBZFtbgGCRgEBAQ X-IPAS-Result: AvIBAEw7e1TU4xEKnGdsb2JhbABbg1dYxnYGhlICgQgWAQEBAQERAQEBAQEGDQkJFC6EAwEBAwFVJAULC0ZXBhMJiC4NCdIPAQEBAQEBBAEBAQEBHYpLhgomB4I0U4FBBYYDi0oChQqFbodNBZFtbgGCRgEBAQ X-IronPort-AV: E=Sophos;i="5.07,487,1413237600"; d="asc'?scan'208";a="110317366" Received: from mout.kundenserver.de ([212.227.17.10]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Nov 2014 16:49:34 +0100 Received: from office1.lan.sumadev.de (dslb-088-069-138-007.088.069.pools.vodafone-ip.de [88.69.138.7]) by mrelayeu.kundenserver.de (node=mreue102) with ESMTP (Nemesis) id 0Lh6mt-1YHSx91sj1-00oWYK; Sun, 30 Nov 2014 16:49:32 +0100 Received: from [192.168.65.10] (unknown [192.168.65.10]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 9438CDC05D; Sun, 30 Nov 2014 16:49:31 +0100 (CET) Message-ID: <1417362565.6436.88.camel@e130.lan.sumadev.de> From: Gerd Stolpmann To: Jordan W Cc: caml-list@inria.fr Date: Sun, 30 Nov 2014 16:49:25 +0100 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-G4ycRTo8s4t2oLUXimXa" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V02:K0:g7kgh0+NKNUQwv7UqITHRI3elHaBDefKfSKHZP+UPq/ 5TPQ58QxDUcFtnUXYFAPL5Cdkkj2jUS5jIGT2jRuuORKCdhdYp HOaHuKOyRzHYo/tJmryQWCb6YRu5zFRJqZXUnC1jdTjWqyiXrY Zy+SlqvVbvARNywmdmZiaKHc46lY8j2+09uCi8SpBH5rR5ruVV SJ7d3/WDm/jnaiHsGpwPp1Dc7LJdevvG38jn3APRV84P3Mo54Z 5H797ldYWKdHbLiKM2MHlldbkjhfxurkNnMpgB0zWCFH6CTRNL 4++QVVbkqVG+D+I9c3PhoSr7th3YGTHFqTPZfdBTU1R+uDrF8E I9qvofsJ22ZqAwEvkbzrF6AHwJSi/il3qOGXq14trot1OeFX81 LOiIKllV26G8w== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [Caml-list] Object Features --=-G4ycRTo8s4t2oLUXimXa Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Samstag, den 29.11.2014, 20:24 -0800 schrieb Jordan W: > 2. Object extension: I believe that OCaml immediate objects are fairly > under-appreciated, I wouldn't say so. As I'm not a big fan of inheritance immediate objects are the simpler and more expressive of dealing with objects. > and most people could find useful applications for them (at least) in > the form of row polymorphic records. However, there are several > features that would make them even more powerful. The feature I long > for the most is object extension (on immediate objects). OCaml has > support for extending objects (inheritance), but only via classes. Basically, the availability of inheritance is the big difference between classes and functions returning immediate objects. As of now, you need to define classes if you want extensibility. But inheritance is of course more than that; in particular you can also override existing methods (and that's what I in particular don't like about it, as this leads to hard to understand program flows). What could in deed be useful is a more light-weight construction that layers objects, i.e. you define a new object around an existing one: Something like let new_object (old_object : t) =3D object (* Define some new methods: *) method foo =3D ... (* And make all methods of old_object also available *) method _ =3D old_object # _ (* This notation shall mean that we define all methods x as method x =3D old_object # x and do this for all methods from t that haven't been defined otherwise *) end This is very different from inheritance, because you have an outer object and an inner, and the interface of the inner object is respected (i.e. if another method of old_object calls foo, it is sure it calls the version of foo in old_object, and not the new definition in new_object). And this layering or wrapping construction is of course compatible with immediate objects. Gerd --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-G4ycRTo8s4t2oLUXimXa Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJUezyFAAoJEAaM4b9ZLB5TgOgH/2tbTTFvr4g10Y8qGKVGrc0m 2g16O+hXrMkxvSiZJE0DF8xTblbpqhUytEPzosJhlJ6eCruPCP4GmUos+eavZ5mh Gf/XPoe/t6qT+cgyiO2xCMLGawJ3QXfXLHGhX0y8celsrTjGIN+2djff/Pkr1P5z qeas9ObSaZXB/vlt8AKwlq+NtYXaJURzRfo+65niHGsWuDzqZ0riXHeTATFvTrWA IUhBEgjadT479I0t8UL2BgE7+u+5Wnnd++h9EtG2Yvwh72ZFpKWKS+1jQhZw0pMK OfenbtxL5uHxc8NUprY7wXUmwldl0YQnWM45o+avoxx03tH8BeOGANiak4C2n+8= =gFu1 -----END PGP SIGNATURE----- --=-G4ycRTo8s4t2oLUXimXa--