Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I like the way static extensions are done in Haxe https://haxe.org/manual/lf-static-extension.html

Using macros you can auto enable them for all types in a project, package, or module.

And opposite to Dart you don't need to define the extension methods in special extension classes but regular utility classes or modules.



Interesting. Do you need to put the extension method in a utility class at all though? Could we put it in the Main class in the example?


The static method can be anywhere afaik.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: