This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 06/06/2011 07:28 AM, Jamison Hope wrote:On Jun 4, 2011, at 3:15 AM, Per Bothner wrote:
Could you try the attached patch? A review would be appreciated as well.
That works for me. Good catch with initializing result to something other than null. I suppose someone could still write a promise that evaluates to Location.UNBOUND, but that's probably unlikely enough to ignore. There's still a minor deficiency in print():
#|kawa:1|# (define my-promise (delay (throw (java.lang.Exception)))) #|kawa:2|# my-promise #<promise - not forced yet> #|kawa:3|# (force my-promise) java.lang.Exception
I would argue that the print at line 4 should say something like
"#<promise - force threw a java.lang.Exception>" instead. How about the
attached update to your patch?
I took your suggestion, but added synchronization. See the attachment.
Note I also changed force to add an extra check after the apply0 call, to
match RnRS semantics for "nested" forcing.
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.
#|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
-- Jamison Hope The PTR Group www.theptrgroup.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |