3 ms·
> just a function that takes in the internal state (including the db contents) as an input No Rails (or other) app has a function like this where the entire co
by treis 4y ago
> just a function that takes in the internal state (including the db contents) as an input
No Rails (or other) app has a function like this where the entire contents of the DB are passed in as a parameter.
And you can't handwave complex internal state as simply another parameter to a function because that complex state can change. That makes the function no longer solely dependent on the parameters passed in. Its behavior is dependent on the parameters passed in plus any changes made by other processes to the complex internal state.
- WJW 4y agoMaybe I've been spending too much time with the state monad, but that still sounds like a function to me. The fact that the DB contents get passed in implicitly as part of the context of a Rails app does not change that.
- discreteevent 4y agoThere's a difference between a "function" that uses implicit contextual state and one that doesn't. We can call it a function with implicit context or we can call it an object or a service or a process. It doesn't really matter as long as we have some way of talking about it. Those other words have been in common use for a long time so it's probably more convenient to use them.