On Tue, 12 Feb 2008, Bill Page wrote: | 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
sorry for the impreciseness -- I considered `Integer' in the sense of IntegerNumberSystem. The number system has no semantics impact on what the `abstract value' is; I should have said `integer' without capital. I don't think there is much ambiguity given we know what the input is -- Integer in the case above. But, as I said, I'm not pushing to accept the script -- in fact, I don't find the way it is written impressive. However, it is part of the testsuite and I wanted to some consensus here before I declare it `alien'. :-) Thanks! -- 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