Comments (4)
I'm closing this and merging #180 which adds HPyHelpers_AddType
as the eventual solution.
from hpy.
I like this idea & I suggested something similar myself in IRC.
The upsides: removes the only non-declarative part of defining types in modules; provides one obvious way to set up a type; helps people avoid accidentally doing slightly odd things during type setup.
Downsides: adds a layer of abstraction; makes it a bit harder to customize type setup; I'm not sure how many types will need to doing something different during type setup.
from hpy.
I like this idea & I suggested something similar myself in IRC.
uh, maybe I read it on IRC and that's why it came to my mind: sorry for the missing attribution 😅.
OTOH, no cookie for you because you didn't open an issue first 😛
The upsides: removes the only non-declarative part of defining types in modules; provides one obvious way to set up a type; helps people avoid accidentally doing slightly odd things during type setup.
Downsides: adds a layer of abstraction; makes it a bit harder to customize type setup; I'm not sure how many types will need to doing something different during type setup.
To be clear, I am not proposing to kill HPyType_FromSpec
: it will still be possible to call it manually, if you want.
Also, note that maybe HPyDef_TYPE
is not needed. We could write directly this:
HPyDef PointTypeDef = {
.kind = HPyDef_Kind_TypeSpec,
.typespec = {
.name = "foo",
.defines = ...
}
};
from hpy.
I started implementing this in #173, but passing a base type or metaclass requires access to the handle for that type, which won't be available statically. This made me wonder whether implementing this is a good idea? Perhaps there is something we can do instead?
from hpy.
Related Issues (20)
- MSVC designated initializer experience in C++ is poor HOT 1
- Functions should not suppress unrelated exceptions
- Add an example or test that uses HPy_mod_execute HOT 2
- HPy universal modules on CPython via a CPython API entrypoint embedded in the extension HOT 1
- Exposing APIs from HPy extensions to be used by other HPy extensions HOT 9
- Design goal of HPyCapsule conflicts with universal mode HOT 9
- debug ctx_Type_GetName does not take trailing NULL into account HOT 2
- HPy helpers deployment HOT 1
- test_metaclass and `set_meta_data`: it seems to be operating on the wrong legacy class? HOT 1
- Duplicate supports_ref_counts HOT 2
- missing tests for _load_bootstrap HOT 3
- ambiguous struct fields in HPyType_Spec HOT 3
- support uses a trick to get a module spec which fails on PyPy HOT 2
- Ambiguous tests in test_hpytype_legacy.py
- Return an error state from HPyField_Store HOT 4
- HPyGlobal: debug mode should check registration in HPyModuleDef->globals HOT 4
- HPyErr_Format missing HOT 3
- `python setup.py` and the use of `setup.py` as a command line tool are deprecated HOT 14
- ABI for unboxed calls from JITs (and cython, etc.)
- Support the Meson build system with meson-python
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hpy.