Erk- / genfut

Generate bindings for Futhark
ISC License
37 stars 10 forks source link

Various suggestions for changes and improvements. #35

Closed Ulrik-dk closed 1 year ago

Ulrik-dk commented 2 years ago
Erk- commented 2 years ago

Looks like some good changes.

  • Begins an implementation of explicit free(), in order to allow handling of Missing deallocation of context object #15. Implementing Drop would require a much more involved rewrite it seems. Being able to explicitly call free() instead might be good enough, and work.

Regarding this point, I think the free function should be marked unsafe as the caller have to ensure that no methods to it are ever used again else we would run into a use-after-free.

The solution would likely be to remove the inner arc from the type and resolve the issue in that way, though this leads to some degradation of the user experience so maybe the api has to be changed around a bit for it.


Another way would be to save a flag if it has been freed and then panic, if that is done we don't need unsafe.

Ulrik-dk commented 1 year ago

I used the built-in github "sync fork" functionality, but that turns out to merge the master branch into the fork, so I undid it, and found a way to rebase instead. This is why the history has been messed up a bit.