Hacker News new | ask | show | jobs
by konamicode 2646 days ago
I'd be keen to see a simple example of this pattern in Lisp (or another language). Does anybody have a good link?
3 comments

I use it by default for new Node.js projects (most of which are experiments but some end up in production, and have been running without problems for years).

It's a simple pattern to implement. To make it a bit easier to use repeatedly, I've got a small helper class called JournaledCollection. You pass it serialize+deserialize callbacks for your item type, and it takes care of persistence in event logs.

For a while I was thinking about releasing my helpers as a project called LAUF, short for "Lame-Ass Un-Framework". Then one could say: "Most of my projects are LAUFable, I don't need anything more serious." (Awful dad jokes are a solid reason to publish open source, right?)

Never got around to it though, but if you're interested, I could put together an example.

I like the name -- and it sounds worth sharing!

    sjl at alephnull in ~/Desktop 
    ><((°> sbcl 
    
    [SBCL] CL-USER> (defparameter *name* "World") 
    *NAME* 
     
    [SBCL] CL-USER> (defun foo () (format t "Hello, ~A~%" *name*)) 
    FOO 
     
    [SBCL] CL-USER> (sb-ext:save-lisp-and-die "session.core") 
     
    sjl at alephnull in ~/Desktop 
    ><((°> sbcl --core session.core 
    
    [SBCL] CL-USER> (foo) 
    Hello, World 
    NIL
Here's one I'm currently using in node (wrote it as another comment): https://news.ycombinator.com/item?id=19499799