<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 04.04.13 20:47, Richard Tew wrote:<br>
</div>
<blockquote
cite="mid:CAN=X-TF9SB0xXy8N0EOjbkz2gc06jwhZJFXqeBWNn2cqtmtJiQ@mail.gmail.com"
type="cite">
<div dir="ltr">On Fri, Apr 5, 2013 at 4:09 AM, Kristján Valur
Jónsson <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:kristjan@ccpgames.com" target="_blank">kristjan@ccpgames.com</a>></span>
wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-GB">
<div>
<p class=""><span style="color:rgb(31,73,125)">I’ve
been thinking some more about this.
</span></p>
<p class=""><span style="color:rgb(31,73,125)">It
should be ok to kill a tasklet that hasn’t run
yet. And killing a dead one should be a no-op.</span></p>
<p class=""><span style="color:rgb(31,73,125)">Rather
than making “kill” have special semantics, how
about just applying that rule? An exception sent
to a tasklet that hasn´t run yet just disappears
and the tasklet dies.</span></p>
<p class=""><span style="color:rgb(31,73,125)">An
exception sent to a dead tasklet just disappears.</span></p>
<p class=""><span style="color:rgb(31,73,125)">I think
these are sensible semantics. In my opinion, it
was a mistake to design stackless such that
uncought tasklet exceptions were sent to the main
tasklet.</span></p>
</div>
</div>
</blockquote>
<div><br>
</div>
<div style="">I disagree. I think there's an argument to be
made that when a new tasklet gets inserted into the
scheduler, it is effectively running. The user does not
know, or care, when it actually starts running as long as
it duly gets run in a fair manner. My expectation would
be that an exception raised on a not yet run by (but
inserted in) the scheduler tasklet, would be raised on the
main tasklet - as it has not been caught. Also, I would
expect that raising an exception on a dead tasklet would
error.</div>
<div style=""><br>
</div>
<div style="">For the most part, I just start tasklets. I
expect them to run. But when I start micromanaging them
and holding references to them to do more advanced usage,
I already do things like checking to see if they are alive
before performing operations on them. Or checking to see
if they are blocked on a channel. Or whatever. I think
that based on my usage of tasklets, if someone is throwing
exceptions on tasklets, they should be explicit in terms
of the expected situation. This means that it is not
unreasonable to expect them to check the tasklets state
before raising exceptions on them.</div>
<div style=""><br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
I'm in the same boat.<br>
Letting things just pass trough as a no-op is error-prone, because<br>
it hides programming errors where an alive tasklet is expected,<br>
but it was dead.<br>
I believe it is better to support explicitly the expected situation
instead<br>
of making things too "handy", meaning sloppy style.<br>
Fiddling around with tasklets is anyway not a feature that should<br>
normally be used by users, so it is probably used in a framework.<br>
But there things should be clean and unambiguous, to avoid hard to<br>
track errors.<br>
<br>
cheers - chris<br>
<pre class="moz-signature" cols="72">--
Christian Tismer :^) <a class="moz-txt-link-rfc2396E" href="mailto:tismer@stackless.com"><mailto:tismer@stackless.com></a>
Software Consulting : Have a break! Take a ride on Python's
Karl-Liebknecht-Str. 121 : *Starship* <a class="moz-txt-link-freetext" href="http://starship.python.net/">http://starship.python.net/</a>
14482 Potsdam : PGP key -> <a class="moz-txt-link-freetext" href="http://pgp.uni-mainz.de">http://pgp.uni-mainz.de</a>
phone +49 173 24 18 776 fax +49 (30) 700143-0023
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a></pre>
</body>
</html>