On Jul 27, 2013, at 17:57 , Marvin Humphrey <[email protected]> wrote:
> Cool! I'm looking forward to deleting a bunch of code from
> perl/buildlib/Lucy/Build/Binding/*.pm. :) It would be great if stuff like
> this was no longer necessary, because all classes were fully bound by default:
>
> sub bind_andmatcher {
> my $binding = Clownfish::CFC::Binding::Perl::Class->new(
> parcel => "Lucy",
> class_name => "Lucy::Search::ANDMatcher",
> );
> Clownfish::CFC::Binding::Perl::Class->register($binding);
> }
+1
> We're close, but not quite there. When I make this change to
> perl/buildlib/Lucy/Build/Binding/Search.pm, we lose the autogenerated
> constructor binding `XS_Lucy_Search_ANDMatcher_new` from Lucy.xs.
>
> --- a/perl/buildlib/Lucy/Build/Binding/Search.pm
> +++ b/perl/buildlib/Lucy/Build/Binding/Search.pm
> @@ -21,7 +21,7 @@ $VERSION = eval $VERSION;
>
> sub bind_all {
> my $class = shift;
> - $class->bind_andmatcher;
> + #$class->bind_andmatcher;
> $class->bind_andquery;
So shall I can extend my changes to generate constructor XSubs for every class?
> If the XSUB binding for Serialize() were implemented as above, we will wind up
> in an infinite loop when we invoke `$my_query->serialize($outstream)`:
>
> 1. Enter Perl subroutine `MyQuery::serialize`.
> 2. Enter XSUB `Lucy::Search::Query::serialize`.
> 3. Enter callback stub `Lucy_Query_Serialize_OVERRIDE`
> 4. Goto 1.
Ah, yes. I didn't realize that with dynamic dispatch we'd call back into
Perl-space.
Nick