You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Working with the DRJIT_STRUCT feature in python, I have found that It would be useful to have a drjitstruct decorator.
This decorator would generate the required DRJIT_STRUCT dictionary from the annotations of the class variables.
If I want to declare a class as a struct for Dr.Jit I would have to add the DRJIT_STRUCT dict to the class and re-define the variables. This is somewhat redundant and also could lead to potential problems when one forgets to specify some variables.
I have used this implementation in some of my projects and wanted to ask iff there is interest in implementing such a feature directly in Dr.Jit before opening a PR.
The text was updated successfully, but these errors were encountered:
This is something we'd like to have. I can't exactly remember the details, but we had attempted something similar to your suggested implementation and found some corner cases which would not be handled.
Thanks for expressing interest in this, we'll have a look at it again 👍
Hi,
Working with the
DRJIT_STRUCT
feature in python, I have found that It would be useful to have a drjitstruct decorator.This decorator would generate the required
DRJIT_STRUCT
dictionary from the annotations of the class variables.If I want to declare a class as a struct for Dr.Jit I would have to add the
DRJIT_STRUCT
dict to the class and re-define the variables. This is somewhat redundant and also could lead to potential problems when one forgets to specify some variables.My proposal would be to add a
drjitstruct
decorator that generates this dictionary automatically.A potential way of implementing such a decorator would be the following.
I have used this implementation in some of my projects and wanted to ask iff there is interest in implementing such a feature directly in Dr.Jit before opening a PR.
The text was updated successfully, but these errors were encountered: