I have made a dependency injection module. It uses a hack I discovered with default parameters. function (x = SomeDependency) {}
. SomeDependency is not defined, but I can parse its toString (same for class constructors, arrow functions and terse object methods). It's not meant to be supported in the browser, only in Node.
My question: I could not find any documentation on whether arguments are lazily evaluated, does any specification/documentation on this exist? Or is this simply undefined behaviour?
Update:
What I am doing is using undefined default parameters (as in the example above), and parsing the toString of the function/class to find out what they are, then calling the function or newing up the class with injected arguments.