lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Dec 14, 2013, at 11:55 PM, Sir Pogsalot <sir.pogsalot@gmail.com> wrote:


In which case you are essentially asserting to yourself that, under acceptable constraints, that expensive network call IS (in effect) a pure function.

—Tim

Teeeechnically it would be impure every time because networking means I/O. :>

Agreed .. as noted elsewhere to get true “pure” functions requires additional constraints (see Haskell if you really want an example). My point was that “purity” here can be stretched based on domain-specific knowledge. In effect, a cache (even a hardware cache) is a type of memorized function, though with some special characteristics, and of course we all try to cache network stuff.

FWIW, I don’t think it is possible to create a useful generic memorized function in Lua .. if it’s truly generic it is going to be so complex (=slow) that I doubt its usefulness.

—Tim