Cannot destroy objects of type T
Is this something that new generics can help with?
Yes, the way that I would imagine it is:
- there would be a type class for destroyable types
- in a function foo<T: Destroyable>(...) you would be able to destroy objects of type T. Similar for classes.
Workaround for current Wurst: Without type classes, you could pass a destroy function as a parameter.
Thanks @peq. I wonder if it makes sense to implement destroy for native types with no-op, so that destroy is globally implemented trait. That would be a nice stop-gap before new generics
That would not help without new generics. With current generics, T is erased and there is just an int. So destroy would always be a no-op for generic types, which would be very confusing.
So @peq, your new job is very boring and you will definitely spend some time on wurst soon, right? 🙃