On Fri, 2007-11-30 at 04:51 +1100, skaller wrote:
> .
> 
> To put this another way the lookup is trying to work on
> 
>       fun add[t]: t * t // use overloading to bind t
> 
> when it should be working on
> 
>       var add: t * t // no overloading, t is a fixed type
> 
> [The actual code handling this is a mess ...]

In particular the Ocaml reads:

and merge_directives syms rs env dirs typeclasses =
  let env = ref env in
  ..
  iter
  (fun dir -> match dir with
  ..
  | DIR_open (vs,qn) -> add_qn (vs,qn)
 )
 dirs;
 iter add_qn typeclasses;
 !env

so that the qualified name Real[t] in this:

        ffmt[t with Real[t]] (v:t) => ...

is treated just the same as if

        open[t] Real[t];

had been written. But the cases are different. In the first
case 't' should also be pushed into the environment, and
treated the same as a function parameter. But actually,
after binding these textual names, a lookup of add: ...
will find the same environment in both cases and try
to bind the typeclass 't' in both cases.


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to