[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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,
> > Heavier in terms of efficiency, or syntax?
>
> My concern is the former. The extra two fields per "record" and the heavier
> runtime calls make them so systemically slower that (to me, at least) it
> just feels "wrong" to use objects just to achieve a little syntactic clarity
> and a small reduction in the amount of code written. Polymorphic variants
> (which use only slightly more memory than regular variant values) otherwise
> perform at the same speed as their normal counterparts.
I also meant "heavier" in terms of efficiency. And like David said, it does
feel wrong to carry the performance penalty of the object system solely because
I need the structural subtyping features. Ideally, what I should be using
is "record subtyping": something along the lines of the Polymap extension
(which I advise everyone to take a look at), but with compile-time checking.
However, my guess is that proper record subtyping cannot be tacked onto the
language by means of Camlp4, and it probably needs to be a builtin feature
(though I would gladly be proven wrong). Which leads to the obvious question:
is there any theoretical reason why record subtyping is not available in Ocaml?
Or is the answer simply "just use the object system; it's not as heavy as you
think it is"?...
Cheers,
Dario Teixeira