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

Cannot destroy objects of type T #989

Open
Cokemonkey11 opened this issue Mar 8, 2021 · 4 comments
Open

Cannot destroy objects of type T #989

Cokemonkey11 opened this issue Mar 8, 2021 · 4 comments

Comments

@Cokemonkey11
Copy link
Collaborator

Is this something that new generics can help with?

@peq
Copy link
Collaborator

peq commented Mar 9, 2021

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.

@Cokemonkey11
Copy link
Collaborator Author

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

@peq
Copy link
Collaborator

peq commented Mar 13, 2021

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.

@Cokemonkey11
Copy link
Collaborator Author

So @peq, your new job is very boring and you will definitely spend some time on wurst soon, right? 🙃

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

No branches or pull requests

3 participants