Le mercredi 19 juin 2013, Scott Dial  a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 6/18/2013 4:40 PM, Victor Stinner wrote:<br>
> No context argument<br>
<br>
I think there is a lack of justification for the extra argument, and the<br>
extra argument is not free. The typical use-case for doing this<br>
continuation-passing style is when the set of contexts is either<br>
unknown, arbitrarily large, or infinite. In other words, when it would<br>
be either impossible or impractical to enumerate all of the contexts.<br>
However, in this case, we have only 3.</blockquote><div><br></div><div>See the use case 3 in examples. Without the context argument, you have to copy/paste 3 times each functions: 3 functions -> 9 functions. I don't like having to copy/paste code, it sounds like a bad design.</div>
<div> <span></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And in the latter case, there is no extra indirect branching in the<br>
hot-path of the allocators.</blockquote><div> </div><div>Are you concerned by performances? Did you see the Performances section, there is no overhead according to the benchmark suite.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Also, none of the external libraries cited introduce this CPS/ctx stuff.</blockquote><div><br></div><div>Oops, the list is incomplete. Copy/paste from the issue:</div><div> <br></div><table class="messages" style="border-spacing:0px;width:735px;clear:right">
<tbody><tr><td colspan="4" class="content" style="font-family:monospace;background-color:rgb(239,239,239);border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(175,175,175);empty-cells:show;border-right-width:1px;border-right-style:solid;border-right-color:rgb(175,175,175);vertical-align:top;padding:2px 5px;max-width:50em;border-left-width:1px;border-left-style:solid;border-left-color:rgb(175,175,175)">
<pre style="word-wrap:break-word"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span style="line-height:normal;white-space:normal;background-color:rgba(255,255,255,0)">Some customizable memory allocators I know have an extra parameter "void *opaque" that is passed to all functions:

- in zlib: zalloc and zfree: <a href="http://www.zlib.net/manual.html#Usage" style="text-decoration:none">http://www.zlib.net/manual.html#Usage</a>
- same thing for bz2.
- lzma's ISzAlloc: <a href="http://www.asawicki.info/news_1368_lzma_sdk_-_how_to_use.html" style="text-decoration:none">http://www.asawicki.info/news_1368_lzma_sdk_-_how_to_use.html</a>
- Oracle's OCI: <a href="http://docs.oracle.com/cd/B10501_01/appdev.920/a96584/oci15re4.htm" style="text-decoration:none">http://docs.oracle.com/cd/B10501_01/appdev.920/a96584/oci15re4.htm</a>

OTOH, expat, libxml, libmpdec don't have this extra parameter.</span></font></pre><pre style="word-wrap:break-word"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" size="3"><span style="line-height:normal;white-space:normal;background-color:rgba(255,255,255,0)">Victor</span></font></pre>
</td></tr></tbody></table>