Wiki

Clone wiki

pyd / Changes

Going Forward

Changes to the API that ensure consistency across the various platforms that pyd intends to support are on the table. Otherwise, we will try to avoid change.

Older API Changes

Since Pyd was originally written, D has evolved into a much more formidable language. For this and other reasons, the following changes have been made to Pyd's API:

Operator Overloading

It was automatic. It is now explicit.

Reflected operator overloading is now supported.

See Class Wrapping for details.

Init

Init parameters were once written

Init!(void function(int), void function(double, double))

Now they are written

Init!(int),
Init!(double, double)

def

def no longer has a MIN_ARGS param, and the parameters of def and most of the parameters of class_wrap have changed to a keyword style.

Example old:

def(modulename, fn, pyname, fn_t)(docstring);

Example new:

def(fn, PyName!pyname, fn_t, ModuleName!modulename, Docstring!docstring)();

Notes

  • fn must be the first argument; otherwise order of parameters does not matter.
  • fn_t is not wrapped by a template.

All function wrapping utilities now support default arguments and typesafe variadic arguments. Wrapped functions may now be called in python with keyword arguments.

Conversion functions

conversion functions have been renamed.

OldNew
d_typepython_to_d
_pyd_to_python
PydObject.toDItemPydObject.to_d
python_to_dex_python_to_d
d_to_pythonex_d_to_python

naming convention

Many functions in pyd have been renamed to enforce the following naming convention:

  • functions: lowercase_with_underscores
  • templates, classes, etc: CamelCase

Updated