Le mercredi 19 juin 2013, Scott Dial a écrit : > On 6/18/2013 4:40 PM, Victor Stinner wrote: > > No context argument > > I think there is a lack of justification for the extra argument, and the > extra argument is not free. The typical use-case for doing this > continuation-passing style is when the set of contexts is either > unknown, arbitrarily large, or infinite. In other words, when it would > be either impossible or impractical to enumerate all of the contexts. > However, in this case, we have only 3.
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. > And in the latter case, there is no extra indirect branching in the > hot-path of the allocators. Are you concerned by performances? Did you see the Performances section, there is no overhead according to the benchmark suite. > > Also, none of the external libraries cited introduce this CPS/ctx stuff. Oops, the list is incomplete. Copy/paste from the issue: Some customizable memory allocators I know have an extra parameter "void *opaque" that is passed to all functions: - in zlib: zalloc and zfree: http://www.zlib.net/manual.html#Usage - same thing for bz2. - lzma's ISzAlloc: http://www.asawicki.info/news_1368_lzma_sdk_-_how_to_use.html - Oracle's OCI: http://docs.oracle.com/cd/B10501_01/appdev.920/a96584/oci15re4.htm OTOH, expat, libxml, libmpdec don't have this extra parameter. Victor
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com