On 11 Feb 2008 22:32:58 -0600, Gabriel Dos Reis wrote: > > Hi, > > Here is a problem -- currently failing -- for type inference in the > interpreter. Consider (taken from current testsuite) > > primes == [p := nextPrime(i = 1 => 2; p) for i in 1..] > primes > > This currently fails, ... > This seems puzzling, because `we know' that the function > `nextPrime' takes an Integer and produces an Integer. > ... > is this really something we think is clear cut, unambiguous, > and the interpreter should know how to resolve it? >
I would say "no" but perhaps for a slightly different reason than expressed so far: Actually it is not accurate to say that "`nextPrime' returns an Integer". What we know is only that: (1) -> )display op nextPrime There is one exposed function called nextPrime : [1] D1 -> D1 from IntegerPrimesPackage D1 if D1 has INS which says just that the type of the result of this function is some domain that has IntegerNumberSystem. There are types other than Integer in this category. So which one should the compiler/interpreter choose? Any of them? (1) -> p:RomanNumeral:=53 (1) LIII Type: RomanNumeral (2) -> nextPrime(p) (2) LIX Type: RomanNumeral Regards, Bill Page. ------------------------------------------------------------------------- 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