I’m curious if it will be possible to enforce pure functional programming with some linting profile in motoko? from the post it sounds like the core features as defaults are there. If so, aside from all the other nifty features, it sounds as the Motoko would have a unique place as a language in the “semi-colon and braces” family as a language where it is possible to enforce pure-FP.
You can probably get far by writing your business logic in a purely functional way (avoiding the
var keyword and mutating library calls as well as non-pure system interfaces). Then you design your outer layer (message handling, actor methods) such that only these update state. Canisters are inherently stateful, and you need that to evolve, unless you have a constant data base or something like an AST evaluator.
As far as I know, there are no linters that warn on (transitive) effects, yet.
The language currently has no way of enforcing purity, since it lacks an effect system, although that’s something we have thought about. The way actors are modelled in the language also relies on impurity to express their state, in order to match the expectations of most programmers.
Does anyone have any good reading recommendations on functional program design—i.e. good practices for code layout, keeping things modular/separating concerns etc.?