<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Scheme Load Return Values</title>
	<atom:link href="http://blog.willdonnelly.net/2009/01/15/scheme-load-return-values/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.willdonnelly.net/2009/01/15/scheme-load-return-values/</link>
	<description>Coding, Mostly</description>
	<lastBuildDate>Tue, 16 Feb 2010 04:51:24 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Peter Bex (sjamaan)</title>
		<link>http://blog.willdonnelly.net/2009/01/15/scheme-load-return-values/#comment-53</link>
		<dc:creator>Peter Bex (sjamaan)</dc:creator>
		<pubDate>Sat, 17 Jan 2009 13:20:02 +0000</pubDate>
		<guid isPermaLink="false">http://willdonnelly.wordpress.com/?p=172#comment-53</guid>
		<description>You&#039;re right that this particular implementation requires SRFI-39. It&#039;s not required for the idea, though: you could also set! a global variable with the value of that continuation, but than you&#039;d have to build in some save/restore mechanism for handling nested LOAD calls (which in practice comes down to an ad-hoc implementation of SRFI-39). By the way, that list of supported systems does not seem very up-to-date. I mean, Chicken 1.0?

*RETURN* doesn&#039;t need to be the last form of the loaded file. If it&#039;s a form halfway down the file, execution is halted and control is passed back to the calling file. But it&#039;s the last form that&#039;s evaluated in the file, indeed. This would be behaviour I&#039;d expect; its behaviour is the same as any other (implicit or explicit) BEGIN. Result of the last form is returned.

Loading the file with *RETURN* unbound isn&#039;t a problem if you stick this mechanism into a separate library, which you must load in every file that uses *RETURN* (which you would do with any other procedure or variable you want to introduce).

The parameter cannot be initialized as #f in this case, but would need to be initialized to EXIT or to something like IDENTITY, depending on the desired semantics of *RETURN* calls outside of a LOAD.</description>
		<content:encoded><![CDATA[<p>You&#8217;re right that this particular implementation requires SRFI-39. It&#8217;s not required for the idea, though: you could also set! a global variable with the value of that continuation, but than you&#8217;d have to build in some save/restore mechanism for handling nested LOAD calls (which in practice comes down to an ad-hoc implementation of SRFI-39). By the way, that list of supported systems does not seem very up-to-date. I mean, Chicken 1.0?</p>
<p>*RETURN* doesn&#8217;t need to be the last form of the loaded file. If it&#8217;s a form halfway down the file, execution is halted and control is passed back to the calling file. But it&#8217;s the last form that&#8217;s evaluated in the file, indeed. This would be behaviour I&#8217;d expect; its behaviour is the same as any other (implicit or explicit) BEGIN. Result of the last form is returned.</p>
<p>Loading the file with *RETURN* unbound isn&#8217;t a problem if you stick this mechanism into a separate library, which you must load in every file that uses *RETURN* (which you would do with any other procedure or variable you want to introduce).</p>
<p>The parameter cannot be initialized as #f in this case, but would need to be initialized to EXIT or to something like IDENTITY, depending on the desired semantics of *RETURN* calls outside of a LOAD.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Donnelly</title>
		<link>http://blog.willdonnelly.net/2009/01/15/scheme-load-return-values/#comment-51</link>
		<dc:creator>Will Donnelly</dc:creator>
		<pubDate>Fri, 16 Jan 2009 22:40:07 +0000</pubDate>
		<guid isPermaLink="false">http://willdonnelly.wordpress.com/?p=172#comment-51</guid>
		<description>Correct me if I&#039;m wrong, but doesn&#039;t that at least require SRFI-39?

While I admire the elegance of that solution, the only Scheme implementations listed* as supporting that one are PLT, Kawa, Guile, Chicken, and SISC.  Of these, Guile does not have it enabled by default, PLT and Chicken do, and the other two are not installed on my system so I can&#039;t test their claims.

Besides which, and I may well be wrong on this because I can never quite understand continuations, wouldn&#039;t that second example have to be the last form in the loaded file?  And on most implementations it would then become impossible to load the file without using that function, because *RETURN* would be unbound.

I do like that solution for a very narrowly defined problem set, but I think that a more general solution might be better for this problem.

* At http://srfi.schemers.org/srfi-implementers.html</description>
		<content:encoded><![CDATA[<p>Correct me if I&#8217;m wrong, but doesn&#8217;t that at least require SRFI-39?</p>
<p>While I admire the elegance of that solution, the only Scheme implementations listed* as supporting that one are PLT, Kawa, Guile, Chicken, and SISC.  Of these, Guile does not have it enabled by default, PLT and Chicken do, and the other two are not installed on my system so I can&#8217;t test their claims.</p>
<p>Besides which, and I may well be wrong on this because I can never quite understand continuations, wouldn&#8217;t that second example have to be the last form in the loaded file?  And on most implementations it would then become impossible to load the file without using that function, because *RETURN* would be unbound.</p>
<p>I do like that solution for a very narrowly defined problem set, but I think that a more general solution might be better for this problem.</p>
<p>* At <a href="http://srfi.schemers.org/srfi-implementers.html" rel="nofollow">http://srfi.schemers.org/srfi-implementers.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bex (sjamaan)</title>
		<link>http://blog.willdonnelly.net/2009/01/15/scheme-load-return-values/#comment-49</link>
		<dc:creator>Peter Bex (sjamaan)</dc:creator>
		<pubDate>Fri, 16 Jan 2009 15:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://willdonnelly.wordpress.com/?p=172#comment-49</guid>
		<description>A more portable way (should work in all implementations) to achieve this is this:

&lt;code&gt;
(define *return* (make-parameter #f))
(call/cc (lambda (k)
  (parameterize ((*return* k))
    (load &quot;file&quot;)))
&lt;/code&gt;

And in the file you load, you can just say &lt;code&gt;((*return*) &#039;my-val)&lt;/code&gt;

I do hope this will come out alright. (wordpress has no &quot;preview comment&quot; mode?)</description>
		<content:encoded><![CDATA[<p>A more portable way (should work in all implementations) to achieve this is this:</p>
<p><code><br />
(define *return* (make-parameter #f))<br />
(call/cc (lambda (k)<br />
  (parameterize ((*return* k))<br />
    (load "file")))<br />
</code></p>
<p>And in the file you load, you can just say <code>((*return*) 'my-val)</code></p>
<p>I do hope this will come out alright. (wordpress has no &#8220;preview comment&#8221; mode?)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
