On Mon, Jun 30, 2014 at 04:48:14PM -0700, Andrew Barnert wrote:
First, two quick side notes:
It might be nice if the compiler were as easy to hook as the importer. Alternatively, it might be nice if there were a way to do "inline bytecode assembly" in CPython, similar to the way you do inline assembly in many C compilers, so the answer to random's question is just "asm [('BUILD_SET', 0)]" or something similar. Either of those would make this problem trivial.
I doubt either of those would be useful often enough that anyone wants to put in the work. But then I doubt the empty-set literal would be either, so anyone who seriously wants to work on this might want to work on the inline assembly and/or hookable compiler first.
Again, to be absolutely clear here, I hate this idea. `set()` is perfectly clear. Sorry. Had to be said before any of this. Right, so, this was brought up before, but with Hylang (https://github.com/hylang/hy), we abuse the PEP 302 new import hooks to search sys.path for .hy files rather then .py files. You could do the same for your .pyu files (again, *without* the blessing of the core team, as this is insane), and do the mangling before passing it to the normal internals to turn it into bytecode / AST. Doing it this way means you won't have to futz with the compiler, and you can remain happy. And we like being happy. More info: https://github.com/hylang/hy/blob/master/hy/importer.py http://slides.pault.ag/hy.html#/15 https://www.youtube.com/watch?v=AmMaN1AokTI https://www.youtube.com/watch?v=ulekCWvDFVI http://legacy.python.org/dev/peps/pep-0302/ Again, this approach can be a bit flaky, and this particular issue might very well cause problems for us as a community - seeing as how the syntax is almost exactly identical. Hylang (for what it's worth) is just a nice way for us Lisp nerds to stop complaining as much. Godspeed, Paul -- #define sizeof(x) rand() </paul> :wq