I'm binding the llvm libraries to felix, and I think I've run into a
typeclass bug. This is compiles through felix fine, but errors out at
the c++ compilation:

//////////////////////////////////////////////////
requires package "llvm";

open C_hack;

typeclass Value[t] {
  virtual proc dump: cptr[t] = "$1->dump();";
}

module Type {
  requires header "#include <llvm/Type.h>";
  type t = "::llvm::Type";

  fun float_type  : unit -> cptr[t] = "::llvm::Type::FloatTy";
}

Value::dump $ Type::float_type ();

fun foo: unit -> C_hack::cptr[int] = "0";
Value::dump $ foo ();
//////////////////////////////////////////////////

But shouldn't this be a type error? It's neat that if we have a fully
implemented typeclass that it works on all types, but here it
obviously won't work. Didn't we use to have to instantiate a type with
a typeclass before we could use it? Should we try to go back to that?
Or is there a better way to protect against this?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to