And just to be clear, if we have a purely virtual function, then it
will require an instance:

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

open C_hack;

typeclass Value[t] {
  virtual proc dump: cptr[t];
}

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

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

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

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

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

Errors out with:

Other exn = Flx_exceptions.Free_fixpoint(_)
CLIENT ERROR
Instantiate virtual procedure(1) dump
In ./foo.flx: line 6, cols 3 to 29
5: typeclass Value[t] {
6:   virtual proc dump: cptr[t];
     ***************************
7: }

See also ./foo.flx: line 6, cols 3 to 29
5: typeclass Value[t] {
6:   virtual proc dump: cptr[t];
     ***************************
7: }

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