Browse thread
Execution time of class versus record
[
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: | Chris King <colanderman@g...> |
| Subject: | Re: [Caml-list] Execution time of class versus record |
On 6/25/07, Jonathan Bryant <jtbryant@valdosta.edu> wrote: > I've always been a little curious about this. Is performance the > _only_ reason for this distinction? Construction and pattern > matching on the two are identical, and AFAIK neither doesn't allow > partial application. Using the tupled form, you can pattern-match the tuple as a whole. E.g. # type t = A of (int * int);; # match A (1,2) with A x -> x;; int * int = (1, 2) This isn't allowed with the non-tupled form. Same goes for construction. (This is where the non-tupled form can actually cost you, if you need to pass around its arguments as a tuple somewhere.) - Chris