Roní,

If you don’t want to upgrade to version 5.7, you can work around the problem 
like this:

val oldMaxInlineSize = !PolyML.Compiler.maxInlineSize;
val _ = PolyML.Compiler.maxInlineSize := 1;
fun ints(n) = Link(n + 1, ints);
val _ = PolyML.Compiler.maxInlineSize := oldMaxInlineSize;

Aside to David: it can take quite a while for new releases to Poly/ML to make 
it into the
various package managers that people like to use. E.g., MacPorts is still on 
version 5.5.2.

Regards,

Rob.

> On 5 Jul 2017, at 08:37, David Matthews <[email protected]> 
> wrote:
> 
> I think you must be using an older version of Poly/ML.  There was a bug in 
> 5.6 and earlier versions that caused the optimiser to loop but that has been 
> fixed in the current version, 5.7.
> 
> Regards,
> David
> 
> On 04/07/2017 17:40, Roní Gonçalves wrote:
>> Actually, I have mistyped the definition of chain before. I am sorry. The
>> definitions are:
>> datatype chain = Link of int * (int -> chain);
>> fun ints(n) = Link(n + 1, ints);
>> And for these definitions, Poly/ML does not work, but SML/NJ does.
>> Best regards,
>> Roní Gonçalves.
>> 2017-07-04 13:37 GMT-03:00 Roní Gonçalves <[email protected]>:
>>> Hello, everyone!
>>> 
>>> I am reading The Little MLer from Matthias Felleisen and Daniel Friedman
>>> using Poly/ML interpreter.
>>> 
>>> In chapter 7, whe have some sort of stream implementation:
>>> 
>>> datatype chain = Link of datatype chain = Link of int * (int -> chain);
>>> fun ints(n) = Link(n + 1, ints);
>>> 
>>> When I try to define the function ints in Poly/ML 5.6 interpreter, it does
>>> not work, it runs forever. But when I write the same code in SML/NJ v110.78
>>> interpreter, things work. Is this difference in their behaviors a bug or is
>>> it normal or expected?
>>> 
>>> Best regards,
>>> 
>>> Roní Gonçalves.
>>> 
>> _______________________________________________
>> polyml mailing list
>> [email protected]
>> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
> _______________________________________________
> polyml mailing list
> [email protected]
> http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to