News for hackers. Stuff that matters.
Re:A polyglot's guide to multiple dispatch – part 3 by batspace on Tuesday April 26, 2016 @05:54PM (#11576032)
At work we have a condition (think: exception) hierarchy that uses multiply inherited mixins. One might be validation-failure and introduce a slot telling you the invalid value. Another might be user-error that records the user that triggered the error. A third might carry an RPC error code for use if reported over RPC.

I used a generic function with list combination to collect from the mixins only the slots that should be reported over RPC. The user is not among them since it is always reported to the user that triggered the error.

Re:A polyglot's guide to multiple dispatch – part 3 by PuercoPop on Tuesday April 26, 2016 @07:44PM (#11576702)
Seems pretty nifty, would love if you could share a gist [implementation] of the idea
Re:A polyglot's guide to multiple dispatch – part 3 by spacebat on Wednesday April 27, 2016 @12:34AM (#11577839)
Ah, it wasn't list, it was append. Though list would be fine if each mixin contributes no more than one item, I wanted mixins to be able to contribute more if necessary, so they always return lists which the combination appends to the result. It also allows them to decide to return nil and behave as though they were not called at all.

Here's a suitably abstracted implementation of the idea: https://gist.github.com/spacebat/dbad3b50684b3a516071abb3757...

Yes I am likening RPC programming to dealing with monsters in the darkness.