Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specification of direction of conversion for function parameters #226

Open
djerius opened this issue Feb 24, 2020 · 1 comment
Open
Labels
🐣Enhancement Things that make it work better

Comments

@djerius
Copy link
Contributor

djerius commented Feb 24, 2020

Sometimes a function uses a parameter only for input or for output. In those cases, the type conversion code can be optimized to convert data in a single direction, rather than assuming that data will need to be converted both to- and from- Perl.

This could be accomplished by creating new types which are optimized for conversion directions. A simple means of indicating this would be to decorate the type names with < and > characters, indicating which direction conversion is required.

For example, >string would convert from Perl to the foreign function, <string would convert from the foreign function to Perl, and <>string would perform bi-directional conversion.

@plicease plicease added the 🐣Enhancement Things that make it work better label Feb 24, 2020
@zmughal
Copy link
Member

zmughal commented Dec 9, 2022

This is something that Glib's introspection API has support for (via annotations): https://gi.readthedocs.io/en/latest/annotations/giannotations.html

(in) | parameters | In parameter. | v0.5.0 unknown

(out) | parameters | Out parameter (automatically determine allocation). | v0.5.0 unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐣Enhancement Things that make it work better
Development

No branches or pull requests

3 participants