On Thu, May 21, 2015 at 4:31 AM, Nick Wellnhofer <[email protected]> wrote:
> I already mentioned that I find the To_Host method useful as it would allow
> us to replace XSBind_cfish_to_perl and its huge if-else-chain with a simple
> call to To_Host. This would mean to implement To_Host for the following
> Clownfish core types:
>
> * String
> * Blob
> * ByteBuf
> * Vector
> * Hash
> * IntNum types
> * FloatNum types
> * Bool

OK, I can see that.  +1

> But I'd like to replace Get_Class, Get_Class_Name, and Is_A with functions.

+1

> Then I'd like to remove Mimic. Obj_Mimic is used in Lucy only once and it's
> trivial to remove.

+1

> We could even consider removing To_I64, To_F64, and To_Bool. They're used in
> Lucy mostly when reading JSON data. But it looks like the actual data type
> is mostly known, so the deserialization code could CERTIFY the input and
> call the appropriate conversion method on either Strings or Nums.

+1, please remove!

That leaves the following methods on Obj.

    Destroy
    To_Host
    Clone
    Compare_To
    Equals

It seems to me that Clone, Compare_To, and Equals, rather than be defined as
methods on Obj, all ought to be defined in separate interfaces.  Obviously we
can't do that until we have interfaces, though. :)

That would leave only To_Host and Destroy.  Which seems appropriate, in terms
of "designing and documenting for extensibility".  The functionality
encapsulated in those two methods is essential to Obj, and both of them need
to be customizable.

I think we may want to rework our object destruction facilities for
compatibility with a tracing GC.  Object destruction under reference counting
involves...

1.  visiting all objects for which a refence is owned and decref'ing.
2.  releasing non-object resources
3.  freeing the object allocation

That first step is very similar to visitation required under mark-and-sweep --
the exact same set of objects needs to be visited.  Each class could define
its own Visit_Refs method, which can be reused with a different callback
under refcounting/tracing-GC.

This will probably happen when I get back to the Python bindings.

Marvin Humphrey

Reply via email to