3 ms·
It seems like this could be a language feature. The key would be an explicit declaration of the identifiers that the function expects to be bound in the calling
by scarmig 7y ago
It seems like this could be a language feature. The key would be an explicit declaration of the identifiers that the function expects to be bound in the calling context. So when declaring the function you optionally specify the dynamically scoped arguments (separately from regular arguments) that callers must have in scope. Doing so allows you to use those dynamic variables within the body of the function.
- erik_seaberg 7y agoScala implicits. It's a curried arg list you can omit, but the compiler checks that you have implicit values of all the needed types in scope. Or you can pass whatever you want explicitly. https://docs.scala-lang.org/tour/implicit-parameters.html https://docs.scala-lang.org/tour/implicit-parameters.html
- mavelikara 7y agoScala's implicit parameters and Haskell's typeclass instances are this, correct?
- eru 7y agoI'm not sure how you'd override the typeclass instance you are going to get easily? (Haskell typically only allows a single instance per type.) OCaml lets you swap out the equivalent of the typeclass instance. But it's a pain, because there system also means that you always have to specify which instance you want.