News for hackers. Stuff that matters.
Re:Why is F# code so robust and reliable? by Jtsummers on Tuesday September 24, 2024 @12:34AM (#41633121)
> - Explicit dependency injection. I've never understood what this means

The article seems to mean what's described in this other article as "dependency parameterization" where the dependency is explicitly passed to the function (and every function it calls that also needs that same dependency). This is as opposed to, in OO languages, setting the dependency (typically) during construction (however the object is constructed). Or it's otherwise set in some larger scope than the functions which make use of it (global, module, object instance, whatever is appropriate to the language and task).

https://fsharpforfunandprofit.com/posts/dependencies/

https://fsharpforfunandprofit.com/posts/dependencies-2/

Re:Why is F# code so robust and reliable? by pjtr on Tuesday September 24, 2024 @02:02AM (#41633501)
Is "let-over-lambda" (variable capture / closure) not possible in F#? Is that not a form of implicit dependency injection?
Re:Why is F# code so robust and reliable? by fire_lake on Tuesday September 24, 2024 @02:33AM (#41633639)
Yes it’s possible.
Re:Why is F# code so robust and reliable? by Zerot on Tuesday September 24, 2024 @03:03AM (#41633834)
Closures are possible, yeah. But F# also has partial application(and currying). So you don't need to use a closure to do this.