Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Get rid of flextype #47

Closed
ghost opened this issue Jan 7, 2014 · 4 comments
Closed

Get rid of flextype #47

ghost opened this issue Jan 7, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented Jan 7, 2014

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


@ghost
Copy link
Author

ghost commented Jan 8, 2014

Original comment by Kristján Valur Jónsson (Bitbucket: krisvale, GitHub: kristjanvalur):


I agree.
I also think that the dynamic module attributes (e.g. stackless.current) should be deprecated, since I don't think any other python code uses this conceps. As they are, they can certainly be emulated using classes :)

@ghost
Copy link
Author

ghost commented Jan 9, 2014

Original comment by RMTEW FULL NAME (Bitbucket: rmtew, GitHub: rmtew):


Once this is done, visit issue #22 which is on hold pending resolution of this issue.

@ghost
Copy link
Author

ghost commented Feb 11, 2014

Original comment by Kristján Valur Jónsson (Bitbucket: krisvale, GitHub: kristjanvalur):


Already working on this.

@ghost
Copy link
Author

ghost commented Feb 13, 2014

Original comment by Kristján Valur Jónsson (Bitbucket: krisvale, GitHub: kristjanvalur):


Merged in krisvale/stackless-scratch/no-flextype (pull request #8)
Closes Issue #47: Getting rid of flextype

@ghost ghost closed this as completed Sep 24, 2017
akruis pushed a commit that referenced this issue Nov 1, 2017
It took me quite a bit to figure out what this was referring to,
since the given issue number is wrong, and the original commit
message I found through git blame lists a different, also wrong
issue number... see https://bugs.python.org/issue27122#msg279449
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

0 participants