Hmm .. i don't know how this ever worked .. :)
+ build/release/bin/flx --output_dir=build/release/test/regress/rt
-Ibuild/release/test/regress/rt --test=build/release -c --test=build/release
build/release/test/regress/rt/darray-01.flx
CLIENT ERROR
Instantiate virtual function(2) str<1814>, no instance for ts=&darray_ctl[int]
In build/release/lib/std/string.flx: line 317, cols 1 to 76
316:
317: proc fprint: ostream * string = "*$1<<$2;" requires
Cxx_headers::iostream;
****************************************************************************
318: fun atoi: string -> int = "::std::atoi($1.data())" requires
Cxx_headers::cstdlib;
See also build/release/lib/std/flx_tclass.flx: line 48, cols 19 to 31
47: typeclass Str [T] {
48: virtual fun str: T -> string;
*************
49: }
instance[T with Show[T]] Str[Darray::darray[T]] {
fun str (x:darray[T])=> str (_repr_ x).a;
}
The immediate problem is that the instance didn't have its abstract types
downgraded,
no idea why but probably just a bug in the downgrading routine.
But the real problem is a design issue: the instance should NOT be applied to
the
downgraded type, imagine if the abstraction is
type metres = new int;
instance Show[metres] { fun str(x:metres)=> str$ _repr_ x + " metres"; }
then the downgrade would either lose the "metres" since it is just a
str on int, or, worse, cause an ambiguity.
The problem is that virtual function calls bind to the virtual, and the
binding to the instance is done later, when it is possible (enough type
variables get resolved to do it). But the delayed binding must still use the
abstract type, not the representation.
On the other hand, accesses via _repr_ and _make_ should access
the representation or they won't be optimised .. hmmm .. looks like
the downgrading HAS to be done right at the end, just before
code generation.
--
john skaller
[email protected]
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language