Version française
Home     About     Download     Resources     Contact us    
Browse thread
How to do this properly with OCaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] "Just say no!" campaign against Obj [was: How to do this properly with OCaml?]
brogoff wrote:
>
> I was able to use the higher order polymorphism of record fields to implement
> polymorphic recursion, WITHOUT using Obj.magic. I posted that approach on the
> list a long time ago, it was really the same trick as using polymorphic methods
> to do the same. You can use that trick to implement the signatures in Okasaki's
> book that use P.R. fairly easily. Why did you need Obj.magic?

I guess the reason is that I could not think of anything better. My
implementation of transaction calculus requiring polymorphic recursion
is of october 2003. I kind of remember a post from you on this issue,
but it must have appeared later.

> Recursive modules provide a nicer approach, IMO, and explicit types even nicer.

I'm not sure recursive modules had been released at that time. 3.06 it
was, IIRC; whereas, recursive modules appeared in 3.07, right?

> My issues with the type system are rarely (if ever) made better by using
> Obj.magic. GCaml and Alice (with it's packages) tackle the main issue,
> which is type safe marshalling.

We have two instances of Obj.magic and and about as many instances of
Marshal.from_xxx. Not once have we escaped the segfault awaiting behind
the bend...

> I agree that a more expressive type system would be nice, and I used Obj
> too to get a set_cdr thing going (like in ExtLib) but if you need efficiency
> that badly then I think it makes more sense to use C and extend OCaml that
> way.

Actually, it is never for efficiency. The type-unsafeties are either due
to marshalling--there's little we can do about it at present--to
polymorphic recursion--I'll look at your proposal based on recursive
modules--or the classic set_cdr thing in a heapsort implementation on lists.

Alex

> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 


-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>