Re: Variable Argument Lists, how to handle?



"Marin Purgar" <m purgar extracom de> writes:

What should be the preffered way to handle the methods accepting variable
argument lists?

For now some of the implemented methods use perl 'proxy' methods which are
converting arrays/hashes to references and then passing them to the
underlaying inline function/method.

The advantage of that is to move some code out of C and have it
in Perl in the .pm; my opinion is that the most perl code we
have, the better.


[...]

But there is mechanism in XS and Inline to pass variable argunemt lists
directly. So there is no need for perl 'proxy' method, it can be directly
written in Inline (as describe at
http://search.cpan.org/author/INGY/Inline-0.43/C/C-Cookbook.pod#Variable_Arg
ument_Lists):


SV* gtkperl_list_store__new(char* class, int n_columns, ...)
{
    Inline_Stack_Vars;

I'm clearly against using that because it would oblige us to stay
with Inline.

I'm seriously considering the ability to have something automatic
(or not) to convert all the Inline .c into one large .xs, at
compilation time (e.g. not in the CVS) (at the end of the
development, or at least when we have something usable) so that
we don't have a large number of .so files, but only one, because
I suppose/hope this is why gtk2-perl takes more memory than
gtk-perl, and has a much higher program startup time.

If we begin to use Inline-specific things in the .c, it would
make this far more difficult.

Anyway, as said above, if we need versatility, I clearly think we
should do it in Perl in the .pm and have one entry-point in the
.c; Perl code is safer, shorter, cleaner.


[...]

Anyway (IMHO) Christian Borup has the point in
http://mail.gnome.org/archives/gtk-perl-list/2002-October/msg00171.html
stating that invocation for such methods should be 'perlish' and no refs
should be passed directly from perl like currently in List->append_items
(mea coulpa ;) or ListStore->set where the perl 'proxy' methods are missing.

Check what proxies methods I've written,
Gtk2::GObject::{set,get}. Doing such things is awfully long and
complicated in C, while it's straightforward and simple in Perl.


-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]