Skip to content

Concrete types #3

@encukou

Description

@encukou

New API "layers" (#2, or a "C-API overhaul") should use concrete types, e.g. PyDictObject * rather than PyObject *.
Then we get type safety from the compiler, and we don't need type checking at runtime.

In the C-specific API, we'll want:

  • Simple upcasts (PyDictObjectPyObject) -- this is just a cast, but let's wrap it for type-safety
  • Fallible downcasts (PyObjectPyDictObject) -- a function that raises on bad type, and a function that
  • Possibly, if API functions autogenerated, we can use C++ overloads & C11 _Generic macros. That would allow taking either PyObject (and possibly raise) or the concrete type (with no overead).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions