Arc Forumnew | comments | leaders | submitlogin
2 points by akkartik 2520 days ago | link | parent

It's in anarki so perhaps it'd be easier to just play with what the different defgenerics (iso, len, ..) there expand to.

https://github.com/nex3/arc/blob/master/arc.arc#L1734

vtables and pickles aren't utilities, just implementation details for defgeneric.

Basically vtables contains a hashtable for each generic function mapping a type to an implementation. "If len gets a string, do this. If it gets a table, do that." The body given to defgeneric sets up vtable entries for a few default types (cons, mainly :), and defmethod lets you add to vtables later.

If the generic function doesn't find an entry in vtables it falls back on searching the pickles table for a procedure to convert that type to cons, before retrying.

Let me know if this makes sense.

(names: I believe vtables comes from C++, and pickle is the python primitive for serialization)