Subject: Developers of Sympa
List archive
- From: Marc Chantreux <address@concealed>, "address@concealed":David Verdin <address@concealed>
- Cc: address@concealed
- Subject: Re: [sympa-developpers] Working on repository
- Date: Tue, 4 Mar 2014 14:01:45 +0100
hello,
On Tue, Feb 25, 2014 at 11:48:01AM +0100, David Verdin wrote:
> >>>sub foo {
> >>> my ($a, $b, $c) = @_;
> >>>}
> >>>foo($a, $b, $c);
> >>>B) named parameters
> >>>sub foo {
> >>> my (%params) = @_;
> >>>}
> >>>C) mixed parameters
> >>>sub foo {
> >>> my ($a, $b, %params) = @_;
> >>>}
> >>>foo($a, $b, option => $c);
> >David, Etienne, Marc, any opinion in this topic
those are topic from past for me as i use Method::Signatures (and Moo
when i need objects). my opinion would be to use it in Sympa too but i
know it's impossible. So i'll share my thougts without having strong
opinion on them.
I prefer a mix of B and C (based on my experience trying to follow the
BPB which was frustrating):
* avoid more than 4 parameters
* every list or hash must be passed as reference
* so "more parameters" are typically references
* the main subject of the function is always on top or tail of the list
(so sometimes i pop $self).
sub foo {
my
( $obvious_mandatory_self_alike
, $obvious_mandatory_parameter1
, $obvious_mandatory_parameter2
, $options );
}
i also im a fan of the (_) and (&$;@) prototypes when they are possible.
> >before it turns out into yet another ping-pong discussion between
> >Soji and myself ?
sorry i'm late on the troll but i was looking on /trunk, not on the list :)
regards
--
Marc Chantreux
Université de Strasbourg, Direction Informatique
14 Rue René Descartes,
67084 STRASBOURG CEDEX
☎: 03.68.85.57.40
http://unistra.fr
"Don't believe everything you read on the Internet"
-- Abraham Lincoln
-
Re: [sympa-developpers] Working on repository,
IKEDA Soji, 03/03/2014
- <Possible follow-up(s)>
- Re: [sympa-developpers] Working on repository, Marc Chantreux, 03/04/2014
- Re: [sympa-developpers] Working on repository, Marc Chantreux, 03/04/2014
Archive powered by MHonArc 2.6.19+.