10 ms·
I really feel the same as the article. Context should be built into programming languages, in broad strokes as designed here. I note that in Scala (and apparen
by andyferris 3y ago
I really feel the same as the article. Context should be built into programming languages, in broad strokes as designed here.
I note that in Scala (and apparently swift) the implicit parameters are type based rather than name based. This works great for “singletons” but is more restricting than the coeffect work referenced. It does solve the problem that having just a single namespace for implicit parameters is bad - nominal types live in their parent namespace.
I’d combine the two and allow to define “context parameters” in module scope. Your base logger library could have a “slot” for the logger, for example. The standard library an allocator. Etc. You’d replace them with `with` or similar, and `with Logging.@logger = Logging.nullLogger()` might let you disable logging within a dynamic context (rather than using `without`). I’d allow `with` to be written in series in a block much like `let`, rather than requiring a bunch of indentation (they would fall out of scope at the end if the block anyway).
Anyway I’d love to have time to contribute towards something like this!