proposed support for lazy values
Per Bothner
per@bothner.com
Tue Jun 7 22:24:00 GMT 2011
On 06/07/2011 03:11 PM, Jamison Hope wrote:
> On Jun 7, 2011, at 2:50 PM, Per Bothner wrote:
>> Note I also changed force to add an extra check after the apply0 call, to
>> match RnRS semantics for "nested" forcing.
>
> I presume by "RnRS semantics" you're referring to the sample implementation
> of make-promise in the R5RS and R6RS reports?
Yes. There is also a testcase in testsuite/test.scm which otherwise fails.
>> Note also that after the grand plan calls for auto-force by display
>> and the REPL;
>> at that point the change to print will primarily affect calls to write.
>
> Right. When that happens, then we'll see output like this, right?
>
> #|kawa:1|# (define a (delay 1))
> #|kawa:2|# (define b (delay 2))
> #|kawa:3|# (define c (delay 3))
> #|kawa:4|# (write a) ; no implicit force
> #<promise - not forced yet>
> #|kawa:5|# (display b) ; implicit force
> 2
> #|kawa:6|# c ; implicit display, which does implicit force
> 3
Correct. This much I have already implemented.
> Calls to format will also implicitly force, right? The documentation for
> the
> ~A directive says "Any (print as display does)." So,
> (format #f "~A~%" (delay 4)) => "4"
It depends on the directive: ~S should not force, but most of the
others should.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Kawa
mailing list