On 08/11/2014, at 1:22 AM, john skaller wrote:

> GRRR ...

Turned out to be this:

        union A = X of int;

Felix ensures the representation of A is just "int",
so you can freely use this construction to create a new variant
of the base type with different methods. This is similar to an
abstract type except that the representation is obscured
rather than hidden.

This is useful with type classes because you can only have one
instance for each type. For example if you have

        class Sortable [T] { virtual proc sort: varray[T]; }

you can implement

        Sortable[int]

so you can sort in ascending order and

        Sortable [A]

to sort in descending order.

Clearly A depends on int, but the dependence wasn't registered.
Indeed the argument of X wasn't registered either (however the construction
is useless unless there are some other ints floating around which would
then be registered .. but not necessarily before A).

SO that's fixed.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to