English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: [Caml-list] Width subtyping
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-06-01 (13:56)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] Width subtyping


> If you're willing to give up some of the syntactic
> niceties of records (and the ability to pattern-match) you
> can get what you want using an abstract type.

Thanks -- that is also an interesting solution.  I'm guessing it will
be faster, though it might consume more memory in cases where only one
field is actually used.  I'll have to try it side-by-side with the object
based solution to see how they compare in the real world with my actual

> Here, we've chosen to use a default value for fields
> that we don't fill in.  We could just as well have used
> options here.  The performance of the above will be roughly
> the same as the performance of a simple record.  Obviously,
> all of the different "subtypes" have the full
> record stored at a physical level.

Which might turn out to be not that big a deal.  After all, the object
based solution also adds some default overhead per object created, right?

Dario Teixeira