Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] CDuce
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain.Frisch@e...
Subject: Re: [Caml-list] CDuce
On Fri, 4 Jul 2003, Matt Gushee wrote:

> On Fri, Jul 04, 2003 at 10:20:14AM +0200, Alain.Frisch@ens.fr wrote:
> >
> > I'm pleased to announce the first public release of CDuce, a new
> > strongly typed higher-order functional programming language for XML
> > documents with an efficient type-based runtime implementation.
>
> This is very interesting. I've compiled it and begun learning the language,

Thank you for your interest in CDuce !

> but there seems to be a problem with type inferencing in the 'load_xml'
> function. Given the following XML:
...
> # let abc : ABC = load_xml "abc.xml";;
>
> Have I done something wrong, or is this indeed a bug?

The point is that CDuce programs are statically type-checked. At "compile
time", there is no way to be sure that the result of load_xml will have
type ABC (load_xml operates at runtime), hence the type error. A possible
way to do what you want is:

let abc =
  match load_xml "abc.xml" with
    | x & ABC -> x
    | _ -> raise "Invalid input file !"

The pattern (x & ABC) succeeds when the argument of the pattern matching
(the loaded XML document) has type ABC, and it binds it to x.

> P.S.: Is there any particular reason your makefile doesn't have an
>   ordinary 'install' target, so that people can easily install the
>   tools for command-line use?

No particular reason. A "cp cduce /usr/local/bin" should do the stuff.


I suggest to keep strictly CDuce related discussions out of the Caml-list.
Interested people can send me an email to join the CDuce users mailing
list.


-- Alain

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners