English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] about Obj.magic
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] about Obj.magic
From: dengping zhu <zhudp@cs.bu.edu>

> After carefully checking my code, I tried to remove Obj.magic from my
> code. Anyway, at last I have to keep one which is not the case you guys
> mentioned. My code is very simple:
> 
> -----------
> type ty = ty1 -> ty2   
> 
> (* where ty1, ty2 are some types I defined before, ty1 is some type like
> g * h, while ty2 likes c * d * e * f. *)
> 
> 
> let x = (f (g)) a
> 
> -----------
> Here, f and g are functions, and the return type of (f (g)) is ty, which
> is a function type ty1 -> ty2. While, the type of a is ty1. So, the
> return type of (f (g)) a should be ty2. Anyway, every time I get an
> error here. The error message is: You applied too many
> parameters... 

The behaviour you describe definitely looks like a bug in the compiler.
But I couldn't reproduce your problem, so I would need the real code
(or a simplified version of it) to check whether this is really a bug.

Another reason might be difference in behaviour between SML and Caml
modules and functors. In Caml all signatures are opaque.
To check this try writing

let x = (f (g) : ty1 -> ty2) a

If you get an error saying that ty is not compatible with ty1 -> ty2,
then this probably means that ty is abstract. This may happen if you
define a signature in which ty appears without the equation ty = ty1
-> ty2. Adding the equation should solve the problem.

Hope this helps, but your description is to incomplete to conclude
anything.

Jacques Garrigue
-------------------
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