Following KMath [Nozik (2018)] Kotlinā currently implements Hirschfield et al.'s (2005) context-oriented programming style. We define a set of numerical contexts within which consumers must perform all operations (e.g. with(DoubleContext) {...}). As Nozik admits, this approach has certaindisadvantages. It is also somewhat awkward to use e.g. in a notebook setting where code may span multiple cells. It should be possible to redefine the type system in a context-free manner to emulate the implicit type conversion semantics of the host language, without enclosing everything inside an explicit context.
Following KMath [Nozik (2018)] Kotlinā currently implements Hirschfield et al.'s (2005) context-oriented programming style. We define a set of numerical contexts within which consumers must perform all operations (e.g.
with(DoubleContext) {...}
). As Nozik admits, this approach has certain disadvantages. It is also somewhat awkward to use e.g. in a notebook setting where code may span multiple cells. It should be possible to redefine the type system in a context-free manner to emulate the implicit type conversion semantics of the host language, without enclosing everything inside an explicit context.