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

Yes that is actually what I meant, I guess I was not being clear. The function calling "display" could have "display" passed as an argument rather than calling it as a globally defined function.

Relying on dynamic variables would probably not be considered dependency injection. A major purpose of DI is that dependencies should be declared in the signature, making it explicit which dependencies a unction or object depends on.



> A major purpose of DI is that dependencies should be declared in the signature

Yes, and a coeffect system would cause dependencies on dynamic variables to be declared statically, even if they're provided by "the environment" at runtime.

Tomas Petricek's PhD project page is a good introduction to coeffect systems, and it illustrates dynamic variables as an example. http://tomasp.net/coeffects/




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

Search: