On Thu, Aug 8, 2013 at 7:45 PM, Paul Davis <[email protected]>wrote:
> A behavior isn't quite right because as Jan points out, you may not > want to implement every hook. Did you see my followup where I compare to gen_server behavior, with only two (significant) hooks to implement, handle_call/3 and handle_cast/2? In my example, there is only one function to implement (on/1) and the API surface is implemented via Erlang pattern matching. Anyway I won't bike shed that much more, I just hope for the easiest possible "hello world" and minimum viable plugin for new developers. > Thinking briefly on the idea I think the > general idea is good but I'd implement it via message passing rather > than callbacks. I agree. Especially for logging, I could easily see a plugin triggering a CouchDB log, and an infinite loop or stuffed mailbox. If you use gen_server, then you are using message passing; but it is implemented for you under the hood. In fact, a gen_server CouchDB plugin would IMO be a fine start. There is plenty of documentation and reference material out there.
