Re: [Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-05 Thread Goswin von Brederlow
rossb...@mpi-sws.org writes: Sylvain Le Gall sylv...@le-gall.net: This is not about optimized compiler in this case but about data representation. Even if you use an optimized compiler (which is not really the case with ocamlopt), you won't change datastructure representation to optimize.

Re: [Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-05 Thread Goswin von Brederlow
Edgar Friendly thelema...@gmail.com writes: On 05/04/2010 07:53 AM, Sylvain Le Gall wrote: On 04-05-2010, AUGER Cédriccedric.au...@lri.fr wrote: type momentum = Moment of kinematic That is does the constructor introduce an overhead or not? As there is only one constructor, no overhead

Re: [Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-05 Thread Yaron Minsky
On Tue, May 4, 2010 at 9:37 AM, Edgar Friendly thelema...@gmail.com wrote: module M : sig type momentum val of_kin : kinematic - momentum val to_kin : momentum - kinematic end = struct type momentum = kinematic let of_kin x = x let to_kin x = x

Re: [Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-05 Thread rossberg
Goswin von Brederlow goswin-...@web.de: This is not about optimized compiler in this case but about data representation. Even if you use an optimized compiler (which is not really the case with ocamlopt), you won't change datastructure representation to optimize. What do you mean? There is

Re: [Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-05 Thread Goswin von Brederlow
rossb...@mpi-sws.org writes: Goswin von Brederlow goswin-...@web.de: This is not about optimized compiler in this case but about data representation. Even if you use an optimized compiler (which is not really the case with ocamlopt), you won't change datastructure representation to

Re: [Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-04 Thread Edgar Friendly
On 05/04/2010 07:53 AM, Sylvain Le Gall wrote: On 04-05-2010, AUGER Cédriccedric.au...@lri.fr wrote: type momentum = Moment of kinematic That is does the constructor introduce an overhead or not? As there is only one constructor, no overhead should be done in an optimized compiler. This is

[Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-04 Thread Sylvain Le Gall
On 04-05-2010, rossb...@mpi-sws.org rossb...@mpi-sws.org wrote: Sylvain Le Gall sylv...@le-gall.net: This is not about optimized compiler in this case but about data representation. Even if you use an optimized compiler (which is not really the case with ocamlopt), you won't change

Re: [Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-04 Thread Fabrice Le Fessant
ocamlopt does optimize data representation: for example, it can unbox floats into registers, or into arrays of floats. However, there is a tradeoff between such optimizations and efficiency: when you do too much representation optimisation, you might end up performing a lot of tests because a

[Caml-list] Re: Subtyping structurally-equivalent records, or something like it?

2010-05-01 Thread Sylvain Le Gall
On 01-05-2010, Dario Teixeira darioteixe...@yahoo.com wrote: Hi, type kinematic = { lin: Vec.t; ang: Vec.t } Which I've been using to represent a medley of physical attributes (force, momentum, velocity, etc.). I second Stéphane's suggestion of using phantom types; moreover, I