Browse thread
(int * int) <> int*int ?
[
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: | Thomas Fischbacher <Thomas.Fischbacher@P...> |
| Subject: | Re: also for tagged records? [Was: Re: [Caml-list] (int * int) <> int*int ?] |
On Fri, 24 Feb 2006, Sebastian Egner wrote:
> This isn't valid Ocaml:
>
> type a = A of {mutable xA: int; mutable yA: int}
> | B of xyB
> and xyB = {mutable xB: int; mutable yB: int}
>
> Background: I had a case (a search tree data strucuture) where
> the additional indirection results in a 30% runtime penalty,
There now are quite a few cases where this "forced extra indirection"
business becomes a nuisance. See for example the older discussion in the
archives on implementing a binary heap properly on the basis of a
variable-length array. The recommended solution is to use a Z option
array, for some type Z.
To a certain extent, this may be considered an issue of mandatory static
type checking and the insistence on minimizing the tagging for in-memory
representations. If static type checking were advisory, and more tag bits
would be used internally, many of these problems could be solved. Besides,
this would offer library implementors the freedom to use somewhat cleaner
dirty tricks under the hood, while still providing a nice and tidy type-safe
interface to the outside.
--
regards, tf@cip.physik.uni-muenchen.de (o_
Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)