Re:Modern Functional Programming: The Onion Architecture
by KirinDave on Thursday September 29, 2016 @11:34AM
(#12606058)
This kind of abstraction layer is really challenging though unless you're totally aware of the extent of your imperative code's side effects.
[ Parent
| on HN ]
Re:Modern Functional Programming: The Onion Architecture
by stingraycharles on Thursday September 29, 2016 @12:19PM
(#12606471)
Isn't this already happening, though, on a low-level (i.e. ASM) ?
Re:Modern Functional Programming: The Onion Architecture
by KirinDave on Thursday September 29, 2016 @01:40PM
(#12607200)
Yes, but the domain of your computer memory is surprisingly disjoint from the domain of your business logic, and that's really what matters here.
Consider a counter-example, where calling a functional method that takes an object and creates a copy with a new field updated (a classic pattern for introducing immutability to a mutable environment). What if internally the constructor calls a log call or increments a shared resource tally?
Not unreasonable, but in a functional context an update now has weird side effects that creates misleading results.
Re:Modern Functional Programming: The Onion Architecture
by nickpsecurity on Thursday September 29, 2016 @08:49PM
(#12609886)
CakeML, a Standard ML subset, can compile to ASM with mathematical proof of correctness. You know your ASM will be what you expected it to be. There's also tools like QuickCheck, QuickSpec, and SPARK that can automate lots of analysis. Tons of work like this in compilers and static analysis with smart people always improving them.
Good chance your business logic will not be handled that well. So, good to structure it in a way to facilitate easy analysis or optimization by tools that currently exist or are in development. You get long-term benefits.