Don't apologize, I'm very grateful for your help :-)<div>I'll take a look at the paper and the documentation</div><div><br></div><div>Cheers<br><br><div class="gmail_quote">2011/8/11 Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Well, continuation-marks are a lower-level, lighter-weight construct<br>
than parameters.<br>
<br>
Sometimes you have to use parameters because that's the api you get to<br>
work with (current-output-port being a popular example of that) and<br>
sometimes you have to use continuation-marks because that's the api<br>
you get to work with (the exn field that you're using, altho this is a<br>
much rarer case).<br>
<br>
Featurewise, parameters have guards, they work with parameterizations,<br>
they can be set directly (as opposed to stored as part of a<br>
continuation) and they behave differently write to the interactions<br>
with threads. Continuation marks don't do any of that.<br>
<br>
Overall, I guess, the best answer is "it depends" and I'm sorry to say<br>
it, but I think that your best bet is to study the constructs yourself<br>
to try to understand them.<br>
<br>
Matthew recently wrote an excellent note about the interactions with<br>
eval and namespaces and why you should or shouldn't use one and I<br>
would love to be able to provide you with the same, but I don't have<br>
such an essay yet. I'm sorry. The best I can offer you is the<br>
documentation and this paper:<br>
<br>
<a href="http://www.eecs.northwestern.edu/~robby/pubs/papers/icfp2007-fyff.pdf" target="_blank">http://www.eecs.northwestern.edu/~robby/pubs/papers/icfp2007-fyff.pdf</a><br>
<br>
I apologize in advance if this is too researchy for what you're looking for.<br>
<br>
Perhaps others have more practical experience and would like to chime in.<br>
<br>
Robby<br>
<br>
On Thu, Aug 11, 2011 at 8:55 AM, Ismael Figueroa Palet<br>
<div><div></div><div class="h5"><<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>> wrote:<br>
> I'll try that in my particular case, however, what is the main difference<br>
> and how do I decide whether to use continuation marks or parameters?? what<br>
> are the advantages/disadvantages of choosing one over the other?<br>
> Thanks<br>
><br>
> 2011/8/10 Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>><br>
>><br>
>> A parameter is implementing using continuation marks (and other things).<br>
>><br>
>> The short version of the story is that you want to say<br>
>><br>
>> (with-continuation-mark 'key 'value e)<br>
>><br>
>> instead of<br>
>><br>
>> (parameterize ([param 'value]) e)<br>
>><br>
>> and then when the exception is raised, you'll find that it has a field<br>
>> that holds the continuation marks in effect at the point where the<br>
>> value was raised. You can then use that to extract the 'value you<br>
>> stored with the 'key.<br>
>><br>
>> There is more information in the manuals about these primitives that<br>
>> you'll want to read but don't hesitate to ask if you get stuck.<br>
>> (Overall, it sounds like it should be much easier to use this approach<br>
>> than the one you were thinking of before.)<br>
>><br>
>> Robby<br>
>><br>
>> On Wed, Aug 10, 2011 at 11:25 AM, Ismael Figueroa Palet<br>
>> <<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>> wrote:<br>
>> > Hi again Robby,<br>
>> > I really don't know much about continuation marks. I want the value A to<br>
>> > be<br>
>> > embedded on the exception structure, because I check that value with a<br>
>> > modified with-handlers macro. I thought that using parameters A will<br>
>> > behave<br>
>> > like a dynamically scoped identifier.<br>
>> > What are the differences, if any, of using continuation marks versus<br>
>> > using<br>
>> > parameters??<br>
>> > Thanks<br>
>> ><br>
>> > 2011/8/9 Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>><br>
>> >><br>
>> >> Could you put the value into a continuation mark and then, when you<br>
>> >> catch the exception, look in the continuation marks to get it out<br>
>> >> again?<br>
>> >><br>
>> >> Robby<br>
>> >><br>
>> >> On Tue, Aug 9, 2011 at 3:56 PM, Ismael Figueroa Palet<br>
>> >> <<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>> wrote:<br>
>> >> ><br>
>> >> ><br>
>> >> > 2011/8/9 Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>><br>
>> >> >><br>
>> >> >> On Tue, Aug 9, 2011 at 3:01 PM, Ismael Figueroa Palet<br>
>> >> >> <<a href="mailto:ifigueroap@gmail.com">ifigueroap@gmail.com</a>> wrote:<br>
>> >> >> > 2011/8/4 Robby Findler <<a href="mailto:robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>><br>
>> >> >> >><br>
>> >> >> >> The blame assignment stuff is wired pretty deep into the contract<br>
>> >> >> >> system. There isn't currently any way to change that aspect of<br>
>> >> >> >> the<br>
>> >> >> >> system without doing what you've done below.<br>
>> >> >> >><br>
>> >> >> >> If you can say more about how/why you want to change it, tho,<br>
>> >> >> >> there<br>
>> >> >> >> maybe some extension to the current API that would work for you<br>
>> >> >> >> and<br>
>> >> >> >> that we'd be willing to maintain going forward.<br>
>> >> >> ><br>
>> >> >> > I defined a new-exn struct to represent exceptions and defined a<br>
>> >> >> > raise<br>
>> >> >> > macro<br>
>> >> >> > that wraps Racket's raise to throw a new-exn value. Also, I need<br>
>> >> >> > to<br>
>> >> >> > raise<br>
>> >> >> > the exception thrown by raise-blame-error inside a parameterize<br>
>> >> >> > expression.<br>
>> >> >> > I want to access and modify a parameter that will be used to<br>
>> >> >> > construct<br>
>> >> >> > the<br>
>> >> >> > new-exn value.<br>
>> >> >><br>
>> >> >> It sounds like you're maybe adding a field to the exn record? Can<br>
>> >> >> you<br>
>> >> >> say more about what that field is and how you compute its value? (Or<br>
>> >> >> if I'm just wrong about that?)<br>
>> >> ><br>
>> >> > Yes, the end result I want is to tag the exn record with a value.<br>
>> >> > That<br>
>> >> > value<br>
>> >> > is stored in a parameter A. I want to make raise-blame-error to<br>
>> >> > always<br>
>> >> > raise<br>
>> >> > an exception tagged with A+1.<br>
>> >> ><br>
>> >> > --<br>
>> >> > Ismael<br>
>> >> ><br>
>> >> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Ismael<br>
>> ><br>
>> ><br>
><br>
><br>
><br>
> --<br>
> Ismael<br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ismael<br><br>
</div>