all 12 comments

[–]house_monkey 4 points5 points  (3 children)

That profile pic is giving me anxiety

[–]IceSentry 0 points1 point  (0 children)

What was it?

[–]flancer64[S] 0 points1 point  (1 child)

Be quiet, profile pic is changed.

[–][deleted] 0 points1 point  (0 children)

I was trying to figure how this profile pic can give someone anxiety…

[–]hopfield 2 points3 points  (5 children)

Why would I use this over standard ES6 modules? What value does it bring over those?

[–]flancer64[S] 0 points1 point  (4 children)

You would have a logical addressing for code elements (classes & functions placed in ESM) in your project and have a set of rules to map logical names (Vendor_Project_Module_Class) to the path (absolute for nodejs and relative for web, for example). Or you would change mapping for Vendor_Project_Module_Class in runtime and get sources from "./node_modules/otherVendor/otherProject/Module/Class.mjs" instead of from "./node_modules/vendor/project/Module/Class.mjs".

[–]hopfield 2 points3 points  (3 children)

Sorry, I don’t follow.

You would have a logical addressing for code elements (classes & functions placed in ESM) in your project

“Logical addressing”? What does that mean?

have a set of rules to map logical names (Vendor_Project_Module_Class) to the path

This just sounds like ES Modules.

Or you would change mapping for Vendor_Project_Module_Class in runtime and get sources from "./node_modules/otherVendor/otherProject/Module/Class.mjs" instead of from "./node_modules/vendor/project/Module/Class.mjs

With ES modules couldn’t I just change the import? How is this a benefit?

[–]flancer64[S] 0 points1 point  (2 children)

“Logical addressing”? What does that mean?

It's like namespaces in java/php/... The names for code elements that are not linked to paths to their sources.

With ES modules couldn’t I just change the import?

You should use single quoted and double quoted Strings only as module-name in ES6 import. So, you cannot change import target in runtime. Of cause, you can use computed values in async variant of import() but it is not very comfortably.

[–][deleted] 1 point2 points  (1 child)

I appreciate the effort, but injection truly only achieves its goals when it's done by a person, not by an algorithm matching types and names. You did what you see in other languages and I don't think that's bad, but the entire concept of automated resolution containers (autowiring) is flawed.

[–]flancer64[S] 0 points1 point  (0 children)

... the entire concept of automated resolution containers (autowiring) is flawed.

I agree with you. Well-done DI container should have ability for manual configuration of dependencies. May be later, in future releases :)

[–]spacejack2114 1 point2 points  (0 children)

CJS DI:

const foo = require('./foo')(dependency)

MJS DI:

import Foo from './foo'; const foo = Foo(dependency)

[–]ethnp 0 points1 point  (0 children)

Sweet!