[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Named params for Perl bindings

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2006-07-21 20:09:21 CEST

On 7/20/06, Nik Clayton <nik@ngo.org.uk> wrote:
> Assuming I get the time to do the work, would anyone be interested in
> patches to the Perl bindings to support named parameters as well as
> positional parameters?
>
> This would mean that as well as being able to write code like:
>
> $ra->get_log([$paths], $rev, 1, 20, 0, 0, sub { ... });
>
> which is a bit obtuse (quick, without access to the docs, which of those '0'
> params is 'discover_changed_paths', and which is 'strict_node_history'?).
> The changes I'm thinking of would let you write code like this:
>
> $ra->get_log({ paths => [ $paths ],
> start => $rev,
> end => 1,
> limit => 20,
> discover_changed_paths => 0,
> strict_node_history => 0,
> receiver => sub { ... } });
>
> Although it's more verbose, it's much more maintainable.

I'd love to see that available in the perl bindings, it would make
things FAR more readable.

> Technically, this would involve any function that takes greater than 'n'
> params looking to see if the first param is a hash ref, and unpacking the
> parameters from the hash ref if so.
>
> I expect (but have not yet checked) that this could probably be automated.
>
> Any suggestions as to what an appropriate value for 'n' might be? I suspect
> that '3' is a sensible minimum (i.e., any function that takes 3 or more
> params should also support named parameters), but I also think that if the
> work's going to happen then, for consistency, all functions should be converted.
>
> Just to stress -- this wouldn't remove the existing calling conventions.
> Just add another option.
>
> Thoughts?
>
> Also, having just spent 20 minutes chasing around the maze of files in
> subversion/bindings, if anyone's got a "This is how SWIG is used with
> Subversion" document, I'd appreciate a peek :-)

I don't know if there's a simple document, but Max Bowsher has been
looking at the swig stuff lately, so if you ask him nicely perhaps he
could condense what he learned into something easily digestible...

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jul 21 20:09:50 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.