Red,<div><br></div><div>While we're sort of on the topic... I recall that Vladimir liked your implementation of conditions in PS quite a bit. If you have a minute, would you care to summarize the basic idea? Alternatively I could just not be lazy and go look at it :)</div>
<div><br></div><div>Daniel</div><div><br><br><div class="gmail_quote">On Tue, Jun 7, 2011 at 12:07 PM, Red Daly <span dir="ltr"><<a href="mailto:reddaly@gmail.com">reddaly@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
At one point I had this implemented using try-catch unless Parenscript's compiler could prove (rather naively) that the return-from clause was always executed. I am usually way behind the official branch, and I'm not sure if my changes ever made it in, and if they did if this case is a bug. Anyway it would do something like<div>
<br></div><div>function foo() {</div><div> try {<br> var bar = function () {<br> throw { 'ps-return-foo341' : 42 };<br> };</div><div> bar(); }<br> catch (e) {</div><div> if ('ps-return-foo341' in e)</div>
<div> return e['ps-return-foo341'];</div><div> else</div><div> throw e;</div><div>};</div><div><br></div><div>verbose, but it should always work. other try-catch tricks allow lisp-style conditions, which I detailed in a post in this list within the year. in case of group interest the relevant code is available at <a href="https://github.com/gonzojive/paren-psos" target="_blank">https://github.com/gonzojive/paren-psos</a> and <a href="https://github.com/gonzojive/parenscript" target="_blank">https://github.com/gonzojive/parenscript</a></div>
<div><br></div><div>Viva Parenscript!</div><div><br></div><div><font color="#888888">Red</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Tue, Jun 7, 2011 at 11:40 PM, <span dir="ltr"><<a href="mailto:sblist@me.com" target="_blank">sblist@me.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I was wondering if the BLOCK/RETURN-FROM feature in PS intends<br>
to support the following case:<br>
<br>
(ps (defun foo ()<br>
(flet ((bar () (return-from foo 42)))<br>
(bar))))<br>
<br>
=><br>
<br>
WARNING: Returning from unknown block FOO<br>
"function foo() {<br>
var bar = function () {<br>
return 42;<br>
};<br>
return bar();<br>
};"<br>
<br>
In order to try and get around the warning, I tried this:<br>
<br>
(ps (defun baz ()<br>
(block foo<br>
(flet ((bar () (return-from foo 42)))<br>
(bar)))))<br>
<br>
=><br>
<br>
WARNING: Returning from unknown block FOO<br>
"function baz() {<br>
var bar = function () {<br>
return 42;<br>
};<br>
return bar();<br>
};"<br>
<br>
but that didn't seem to work. Any ideas on how to achieve lexical<br>
return here?<br>
<br>
- Scott<br>
<br>
<br>
_______________________________________________<br>
parenscript-devel mailing list<br>
<a href="mailto:parenscript-devel@common-lisp.net" target="_blank">parenscript-devel@common-lisp.net</a><br>
<a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
</blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
parenscript-devel mailing list<br>
<a href="mailto:parenscript-devel@common-lisp.net">parenscript-devel@common-lisp.net</a><br>
<a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel</a><br>
<br></blockquote></div><br></div>