wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps
https://wurstlang.org
Apache License 2.0
225 stars 30 forks source link

Cannot destroy objects of type T #989

Open Cokemonkey11 opened 3 years ago

Cokemonkey11 commented 3 years ago

Is this something that new generics can help with?

peq commented 3 years ago

Yes, the way that I would imagine it is:

Workaround for current Wurst: Without type classes, you could pass a destroy function as a parameter.

Cokemonkey11 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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