caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Typing Dynamic Typing in ocaml?
@ 2008-12-17 19:45 Jacques Carette
  2008-12-17 19:58 ` [Caml-list] " Stéphane Glondu
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jacques Carette @ 2008-12-17 19:45 UTC (permalink / raw)
  To: OCaml

I have two (related) questions:
1) Has anyone transcribed the TypeRep library into ocaml?
http://people.cs.uu.nl/arthurb/dynamic.html

2) How do I embed 'dynamically known' data into a single ocaml 
data-structure?

More specifically, I am experimenting with a (new) language which allows 
deduction and computations to be performed with equal ease on its 
terms.  This language uses ocaml has the host meta-language (ie the 
interpreter is written in ocaml).  I would like to be able to use 
arbitrary ocaml data-structures to represent some of my terms, when 
these terms are known to come from specific theories.  For example, I 
would like to use Bigint to represent integers, but without exposing 
that per se.  Perhaps a better way to phrase this would be to say that I 
want to have a "generic external data container" type in my language 
terms, which I can instantiate in multiple different ways (in the same 
program), with data handled in different modules, without having to 
change the 'generic' data-structure everytime I add a new module.

Polymorphic variants of course come to mind - but they would force me to 
add a new type parameter to all my types, which I would rather avoid.  I 
would be quite happy to use polymorphic variants if I could 'hide away' 
the extra type parameter involved with open variants.  My attempts at 
hiding this parameter (with existentials) has been too successful, in 
that once hidden I can't extract my data from this container anymore 
[which is the correct behaviour for the compiler].

I thought of using objects too, but my data does not really have any 
common structure, so the object would be a pure container.  I cannot see 
any advantage over polymorphic variants, and all the same headaches of 
an 'extra' polymorphic parameter remain.

Jacques




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-12-18  1:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-17 19:45 Typing Dynamic Typing in ocaml? Jacques Carette
2008-12-17 19:58 ` [Caml-list] " Stéphane Glondu
2008-12-17 21:08   ` Jacques Carette
2008-12-17 21:15     ` Stéphane Glondu
2008-12-17 21:15     ` Daniel Bünzli
2008-12-17 20:29 ` Mikkel Fahnøe Jørgensen
2008-12-17 21:28 ` David Teller
2008-12-17 22:42 ` Mauricio Fernandez
2008-12-18  1:16 ` Yaron Minsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).