On Wed, Aug 20, 2014 at 2:22 PM, Nick Wellnhofer <[email protected]> wrote:
> On Aug 19, 2014, at 19:52 , Marvin Humphrey <[email protected]> wrote:
>
>> Clownfish is likely to remain in significant flux at least until we've
>> implemented bindings for more languages. Here are some of the upcoming
>> challenges which will likely require modifications to the Clownfish core:
>>
>> * Tracing GC (Ruby, Go)
>
> I’ve also been thinking about this. It should be feasible if we keep track
> of all Clownfish objects that were passed to the host language.
The crucial feature is adding instance data to user-defined subclasses using
standard host idioms.
Under tracing GC, we can always fall back to incrementing the refcount each
time we create a host object wrapper and decrementing the refcount each time a
host finalizer fires. However, that approach is not compatible with adding
instance data to host subclasses, since the lifespan of such instance data
would be tied to the lifespan of a host wrapper -- not the inner Clownfish
object.
BTW, it occurs to me that instead of requiring Perl users to use inside-out
fields, we could enable hashref overloading one every Clownfish
object similar to how we have it on Lucy::Document::Doc.
>> * Non-UTF-8 host string type (Python)
>
> A simple approach would be to reencode every string that is passed from the
> host language and back. But for a more performant solution, Clownfish needs
> support for multiple string encodings.
+1
>> * Limited access to GC internals hampers host subclassing (Go)
>
> I don’t know anything about how Go interfaces with C, but I can imagine that
> the lack of virtual methods in Go poses an interesting problem.
The main challenge is that the Go developers want to write a maximally
efficient compacting copying collector, and that makes it hard to give access
to Go objects from C-space.
http://golang.org/issue/8310
We need some way to prevent Go pointers from crossing the boundary into C.
It's interesting to note that the insular approach explored in that ticket
and Clownfish-style symbiosis are nearly antithetical.
>> This is super fun stuff to work on. :)
>
> I hope you didn’t mean that ironically. It definitely sounds like fun stuff
> to me. :)
Haha, I meant that in earnest!
Marvin Humphrey