Gabriel Dos Reis <[EMAIL PROTECTED]> writes:

> 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

I guess you meant to type i = 1 above.  In that case, the following works:

(1) -> p: INT
                                                                   Type: Void
(2) -> [(p := nextPrime(i = 1 => 2; p)) for i in 1..]

   (2)  [3,5,7,11,13,17,19,23,29,31,...]
                                                         Type: Stream Integer

Note that you have to supply a parenthesis around (p := ...).  I believe that
this helps the interpreter to notice that (p := ...) is actually a function.
This gives us some more information, in fact: without the p: INT, it tells us
that it cannot compile (p := ...), which I find not so surprising anymore.  But
probably, that is exactly what you *did* find surprising, or at least
annoying.  So, what you want is that

(p := f(firstTime? => someValue; p)) 

can be resolved, namely using the meet of someValue and the result type of
f(someValue)...

Looks pretty hard to me, though.

Did I get you?

Martin


-------------------------------------------------------------------------
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

Reply via email to