If you are willing to change the existing uses of parameterize, then you could use a macro to introduce a continuation mark along with the parameter setting. Would that work?<br><br>Robby<br><br>On Tuesday, October 25, 2011, Ismael Figueroa Palet &lt;<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>&gt; wrote:<br>
&gt; Robby,<br>&gt;<br>&gt; The solution you gave works with what I want to do. Thanks!<br>&gt;<br>&gt; The only issue is that the rest of the codebase is already assuming that the values are stored using parameterize, so I need to change all those points to use with-continuation-mark in addition to parameterize.<br>
&gt;<br>&gt; Is there any way to configure parameterize so it also introduces a continuation mark with the same name, and make sure the values are always synced (and so it is captured when exceptions are raised)?<br>&gt;<br>
&gt; It would be something like:<br>&gt;<br>&gt; (parameterize ([param value #:also-as-continuation-mark]) e)<br>&gt;<br>&gt; So if I do (current-continuation-mark &#39;param) it will return the adequate value, in addition to being accessible as a parameter.<br>
&gt;<br>&gt; Thanks again!<br>&gt;<br>&gt; --<br>&gt; Ismael<br>&gt;<br>&gt; 2011/8/10 Robby Findler &lt;<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>&gt;<br>&gt;<br>&gt; A parameter is implementing using continuation marks (and other things).<br>
&gt;<br>&gt; The short version of the story is that you want to say<br>&gt;<br>&gt;  (with-continuation-mark &#39;key &#39;value e)<br>&gt;<br>&gt; instead of<br>&gt;<br>&gt;  (parameterize ([param &#39;value]) e)<br>&gt;<br>
&gt; and then when the exception is raised, you&#39;ll find that it has a field<br>&gt; that holds the continuation marks in effect at the point where the<br>&gt; value was raised. You can then use that to extract the &#39;value you<br>
&gt; stored with the &#39;key.<br>&gt;<br>&gt; There is more information in the manuals about these primitives that<br>&gt; you&#39;ll want to read but don&#39;t hesitate to ask if you get stuck.<br>&gt; (Overall, it sounds like it should be much easier to use this approach<br>
&gt; than the one you were thinking of before.)<br>&gt;<br>&gt; Robby<br>&gt;<br>&gt; On Wed, Aug 10, 2011 at 11:25 AM, Ismael Figueroa Palet<br>&gt; &lt;<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>&gt; wrote:<br>
&gt;&gt; Hi again Robby,<br>&gt;&gt; I really don&#39;t know much about continuation marks. I want the value A to be<br>&gt;&gt; embedded on the exception structure, because I check that value with a<br>&gt;&gt; modified with-handlers macro. I thought that using parameters A will behave<br>
&gt;&gt; like a dynamically scoped identifier.<br>&gt;&gt; What are the differences, if any, of using continuation marks versus using<br>&gt;&gt; parameters??<br>&gt;&gt; Thanks<br>&gt;&gt;<br>&gt;&gt; 2011/8/9 Robby Findler &lt;<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>&gt;<br>
&gt;&gt;&gt;<br>&gt;&gt;&gt; Could you put the value into a continuation mark and then, when you<br>&gt;&gt;&gt; catch the exception, look in the continuation marks to get it out<br>&gt;&gt;&gt; again?<br>&gt;&gt;&gt;<br>
&gt;&gt;&gt; Robby<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; On Tue, Aug 9, 2011 at 3:56 PM, Ismael Figueroa Palet<br>&gt;&gt;&gt; &lt;<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt; 2011/8/9 Robby Findler &lt;<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>&gt;<br>&gt;&gt;&gt; &gt;&gt;<br>&gt;&gt;&gt; &gt;&gt; On Tue, Aug 9, 2011 at 3:01 PM, Ismael Figueroa Palet<br>
&gt;&gt;&gt; &gt;&gt; &lt;<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt; &gt;&gt; &gt; 2011/8/4 Robby Findler &lt;<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>&gt;&gt;&gt; &gt;&gt; &gt;&gt; The blame assignment stuff is wired pretty deep into the contract<br>&gt;&gt;&gt; &gt;&gt; &gt;&gt; system. There isn&#39;t currently any way to change that aspect of the<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; system without doing what you&#39;ve done below.<br>&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>&gt;&gt;&gt; &gt;&gt; &gt;&gt; If you can say more about how/why you want to change it, tho, there<br>&gt;&gt;&gt; &gt;&gt; &gt;&gt; maybe some extension to the current API that would work for you and<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; that we&#39;d be willing to maintain going forward.<br>&gt;&gt;&gt; &gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;&gt; &gt; I defined a new-exn struct to represent exceptions and defined a<br>&gt;&gt;&gt; &gt;&gt; &gt; raise<br>
&gt;&gt;&gt; &gt;&gt; &gt; macro<br>&gt;&gt;&gt; &gt;&gt; &gt; that wraps Racket&#39;s raise to throw a new-exn value. Also, I need to<br>&gt;&gt;&gt; &gt;&gt; &gt; raise<br>&gt;&gt;&gt; &gt;&gt; &gt; the exception thrown by raise-blame-error inside a parameterize<br>
&gt;&gt;&gt; &gt;&gt; &gt; expression.<br>&gt;&gt;&gt; &gt;&gt; &gt; I want to access and modify a parameter that will be used to<br>&gt;&gt;&gt; &gt;&gt; &gt; construct<br>&gt;&gt;&gt; &gt;&gt; &gt; the<br>&gt;&gt;&gt; &gt;&gt; &gt; new-exn value.<br>
&gt;&gt;&gt; &gt;&gt;<br>&gt;&gt;&gt; &gt;&gt; It sounds like you&#39;re maybe adding a field to the exn record? Can you<br>&gt;&gt;&gt; &gt;&gt; say more about what that field is and how you compute its value? (Or<br>&gt;&gt;&gt; &gt;&gt; if I&#39;m just wrong about that?)<br>
&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt; Yes, the end result I want is to tag the exn record with a value. That<br>&gt;&gt;&gt; &gt; value<br>&gt;&gt;&gt; &gt; is stored in a parameter A. I want to make raise-blame-error to always<br>
&gt;&gt;&gt; &gt; raise<br>&gt;&gt;&gt; &gt; an exception tagged with A+1.<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt; --<br>&gt;&gt;&gt; &gt; Ismael<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;&gt; &gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>
&gt;&gt; --<br>&gt;&gt; Ismael<br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br>&gt; --<br>&gt; Ismael<br>&gt;<br>&gt;