-
Notifications
You must be signed in to change notification settings - Fork 62
Get rid of flextype #47

Description
Originally reported by: Anonymous
About Flextype
The flextype module was an early approach to make method calls of classes
faster.
From the docstring in flextype.c :
"An extension type that supports cached virtual C methods"
Flextype is used for tasklets, channels and the stacklessmodule as the base type.
This was a very well working trick to make methods very fast, to override them
from C and from Python, with caching.
I think time is ripe to replace flextype by regular heaptypes, because Python has
good enough caching now.
Another use-case was the ability to define the stacklessmodule with module methods,
something that I thought was missing.
Meanwhile it is easy to create an object by using a class as a module surrogate
and expose some methods. In other words: Flextype is no longer necessary and should go away.
At the same time I think it makes sense to abandon stacklessmodule as it is and replace it by a _stackless module that implements the bare minimum necessary.
All the rest should be implemented in a stackless.py module that makes things
nicer and supplies methods etc.
The _stackless module should for instance hold the current tracing functions to make
them fast callable during a transfer. For retrieving those functions, there is no need for C code. Instead, the stackless.py module should provide a class and access functions to support introspection.
My goal:
turn as much C code into Python code as possible, unless speed is a concern
replace special code by builtin code as much as possible