Re:Functional core, imperative shell (2012)
by fpoling on Saturday September 22, 2018 @04:13AM
(#18045058)
The actor model is prized in the talk. Yet actor model is not functional. The problem is the message queue of each actor. It is an imperative storage and one can get all nasty problems of imperative code from apparently functional code patterns.
[ Parent
| on HN ]
Re:Functional core, imperative shell (2012)
by ramchip on Monday September 24, 2018 @12:48AM
(#18055105)
You can build every actor like a miniature program, with its own imperative shell and functional core. In Erlang it's common to have various message handlers that are very imperative, but defer all complicated logic to pure functions that take part of the actor state and return a transformed state.
Re:Functional core, imperative shell (2012)
by mercer on Tuesday October 02, 2018 @05:20AM
(#18119972)
I've been doing more and more Elixir work, and one of the most important lessons I keep learning is to keep my 'actors' as simple as possible and put the complicated stuff in my 'bags of functions'. I generally try to treat my code as two completely separate layers: the code that does stuff, and the code that orchestrates/isolates all of it.
What I find fascinating is that, at least for me, using GenServers/Agents/Tasks has made this distinction much more obvious than it has been in other languages.
I've built horrifying systems that muddled things together, only to realize quite far in how much of a mess I made, but with my Elixir projects I usually realize what I've done pretty quickly, and I end up course-correcting earlier on.
Re:Functional core, imperative shell (2012)
by yoava on Saturday September 22, 2018 @05:22AM
(#18045232)
Actor model is even worse, you have no gerentee of a response or error status
Re:Functional core, imperative shell (2012)
by shrimpx on Saturday September 22, 2018 @05:22AM
(#18045234)
There aren't that many ways you can mess up a message queue.
Re:Functional core, imperative shell (2012)
by msangi on Saturday September 22, 2018 @05:00AM
(#18045171)
What would a functional approach be?
Re:Functional core, imperative shell (2012)
by fpoling on Saturday September 22, 2018 @05:43AM
(#18045288)
It depends on what is the goal. To take advantage of multicore for computations one can use explicitly parallel functional algorithms. To improve response under load one can do load balancing within application and schedule at the very top (shell level) several independent functional pipelines.