Hi, Here is a problem -- currently failing -- for type inference in the interpreter. Consider (taken from current testsuite)
primes == [p := nextPrime(i = 0 => 2; p) for i in 1..] primes This currently fails, with roughlty the following diagnostic from the interpreter Cannot find a definition or applicable library operation named nextPrime with argument type(s) Polynomial Integer Apparently, the interpreter infers that `p' must stand for a Polynomial(Integer). I spare you the minutiae of that reasoning, but basically, it comes to finding a meet for `Integer', for the expression i = 0 => 2 and a `Symbol' (promoted to Variable p) for the subexpression `p' in i = 0 => 2; p This seems puzzling, because `we know' that the function `nextPrime' takes an Integer and produces an Integer. However, the interpreter does not know that. Rather, the interpreter infers type `bottom up' fashion, by first computing the type of the operands, and then use those type to select a function (modemap selection process). So, the interpreter does not know that `nextPrime' returns an Integer and use that as a `seed' to the type inferencer. Looking more at the expression [p := nextPrime(i = 0 => 2; p) for i in 1..] is this really something we think is clear cut, unambiguous, and the interpreter should know how to resolve it? -- Gaby ------------------------------------------------------------------------- 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/ _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel