breandan / kotlingrad

šŸ§© Shape-Safe Symbolic Differentiation with Algebraic Data Types
https://breandan.net/public/masters_thesis.pdf#page=49
Apache License 2.0
530 stars 21 forks source link

Migrate to context-free grammar #14

Closed breandan closed 4 years ago

breandan commented 4 years ago

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.

breandan commented 4 years ago

300caf7 removes explicit protocol/context.