[Caml-list] CfP: 20th WADT - deadline extended to May, 10th

2010-05-01 Thread Till Mossakowski
[sorry if you receive this more than once] CALL FOR PAPERS DEADLINE FOR TWO-PAGE ABSTRACTS EXTENDED TO MAY, 10th WADT 2010 20th International Workshop on Algebraic Development Techniques

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

2010-05-01 Thread Anthony Tavener
I have this: type kinematic = { lin: Vec.t; ang: Vec.t } Which I've been using to represent a medley of physical attributes (force, momentum, velocity, etc.). As the physics code becomes increasingly substantial I'm running into possible human-error, like passing a momentum where a force is

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

2010-05-01 Thread Stéphane Lescuyer
Hi Anthony, I think that maybe using phantom types could do the trick : consider defining empty types for all the different kinds of similar constructs that you have, and then define the kinematic record with a phantom parameter type. type position type acceleration type force type 'a kinematic

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

2010-05-01 Thread Dario Teixeira
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 recommend you read an article that discusses them to some detail and

[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

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

2010-05-01 Thread Anthony Tavener
Wow! Thanks Stéphane... that was a little piece of magic I was hoping for. It's a bit verbose, but at least it doesn't affect performance and it allows all the control over types I need. I now see I didn't really grok phantom types whenever they were mentioned. A bit of in one ear and out the