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

Add support for type coercion #6

Open
FreddieWitherden opened this issue Jan 15, 2020 · 0 comments
Open

Add support for type coercion #6

FreddieWitherden opened this issue Jan 15, 2020 · 0 comments

Comments

@FreddieWitherden
Copy link

VeoFunction's know the types of their arguments (pointer/integer, float/double). Thus when we call the function it would be nice if py-veo could attempt to coerce whatever objects we pass into these types. For instance, if the type to be passed to the kernel is an integer of some type we should call arg.__index__() on whatever object is passed to VeoFunction.__call__(...). Similarly, if the type is a float or double we should call arg.__float__().

This is nice as it enables one to define smart pointers and would enable one to directly pass a VEMemPtr to a kernel (since VEMemPtr would implement index() and hence would be coerced into an integer upon being passed as an argument to a kernel). It also fits well with the duck-typed nature of Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant