There's some kind of problem at present that goes like this:

When the parser sees:

        a - b
        - c

it translates them to

        - (a,b)
        - c

Now all this works fine if I do:

        open Addgrp[int];
        open Addgrp[long];

but if I do instead

        open [T in typesetof(int,long)] Addgrp[T];

the compiler cannot tell the difference between subtraction and negation:
it tells me these are ambiguous:

        - of T
        - of (T*T)

Of course one could define negation of a tuple. The problem is that when
you do something with a typeset constraint, is done polymorphically first,
THEN the constraint is added after overload resolution to throw out cases
that don't meet the constraint.  But here, the constraint isn't applied.

The reason is the problem actually occurs INSIDE the type class,
where there is no constraint.

There's no bug fix I think, because it isn't a bug. The compiler is 
actually right.

This problem would go away if we used distinct names for
subtraction and negation, and had the parser map the infix
and prefix cases to these names. This is what used to happen.

I changed it, thinking I was smart, to allow "-" and "+" etc to be
names, so the programmer didn't have to lookup which function
name corresponded to infix - (eg "sub") which one used to have
to do.

So the fix is to revert :-) Note that at present type classes have
both names defined eg both neg and sub are defined as well
as both versions of "-". The symbols are the virtuals, the names
are just mapped to them. Swapping this around does NOT solve
the problem.

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




------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to