Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Dario Teixeira <darioteixeira@y...>
Subject: Re: [Caml-list] Width subtyping

Hi,

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


> 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?

Cheers,
Dario Teixeira