3 ms·
The ability to programmatically generate methods/classes can be really powerful and, as far as I can tell, impossible with Typescript (and most statically typed
by akavi 11y ago
The ability to programmatically generate methods/classes can be really powerful and, as far as I can tell, impossible with Typescript (and most statically typed languages).
Back in my Backbone + CoffeeScript days, I reimplemented Rails style has_many/belongs_to "class methods" on Backbone.Model, and it was incredibly useful. But would've been doubly so if I could have had it statically checked somehow.
- mordocai 11y agoI don't know if it is possible in any practically used statically typed languages, but I can think of nothing that would prevent you from doing metaprogramming in a statically typed language on a theoretical basis. It might be a bit hard to implement, but I think it should be perfectly possible.