Hacker News new | ask | show | jobs
by davexunit 4515 days ago
>Pretend for a moment that Javascript had macros (sweet.js where are you?) and the Angular syntax was more explicit:

Well, sure. If and when JavaScript gains hygienic macros (via sweet.js or otherwise), I will like this sort of notation. However, the reality is that JavaScript doesn't have macros currently. Thus, I still dislike the magical dependency notation.

>The last thing you'd expect is a syntax where the injected dependency names were chosen by the implementor of the provider.

I don't see why this is bad. Several languages allow you to rename things in imported modules. The two that I can think of immediately are Python and Guile Scheme. Most of the time there is no reason to rename, but sometimes it is a good idea to rename for clarity or to avoid name clashes. This is something that you can already do via the explicit form of dependency injection.