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]

Re: proposed support for lazy values


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
	at atInteractiveLevel$1.lambda1(stdin:1)
	at atInteractiveLevel$1.apply0(stdin)
	at gnu.expr.ModuleMethod.apply0(ModuleMethod.java:186)
	at kawa.lang.Promise.force(Promise.java:36)
	at kawa.lang.Promise.force(Promise.java:53)
	at kawa.lib.misc.force(misc.scm:99)
	at atInteractiveLevel$3.run(stdin:3)
	at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:286)
	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:187)
	at kawa.Shell.run(Shell.java:281)
	at kawa.Shell.run(Shell.java:194)
	at kawa.Shell.run(Shell.java:175)
	at kawa.repl.main(repl.java:852)
#|kawa:4|# my-promise
#<promise - not forced yet>

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?

--
Jamison Hope
The PTR Group
www.theptrgroup.com


Attachment: Promise2.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]