Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[7924] branches/db_list_cache: [dev] References to global %Conf hash were replaced with Site class accessors.

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] sympa[7924] branches/db_list_cache: [dev] References to global %Conf hash were replaced with Site class accessors.
  • Date: Fri, 9 Nov 2012 23:07:13 +0900

On Fri, 09 Nov 2012 09:36:54 +0100
Guillaume Rousse <address@concealed> wrote:

> Le 08/11/2012 21:59, Guillaume Rousse a écrit :
> > I'd prefer an explicit method call, for better readability:
> > &mail::set_send_spool(Site->queue());

I prefer to "Site->queue" form, because they seem somewhat
"attributes", not "verbs". Also, unlike constants with namespace
separator (::), arrow operator (->) doesn't bring syntactic
ambiguity without "()".

Although, I won't stick to this style if people feel difficulty.

> Actually, I've several similar code style preferences I'd like to
> propose, based on what is usually considered best practices in perl
> community. For instance:
>
> - use direct method call syntax
> My::Class->new()

I agree. "new My::Class()" style is unrecommended and sometimes
doesn't work as expected.

> - use modern perl idiom for heritage:
> use parent qw(Parent::Class)
> instead of legacy one:
> use Parent::Class;
> our @ISA = qw(Parent::Class)

parent pragma became a part of Perl distribution at Perl 5.12.0.

> - use full stricture everywhere:
> use strict

I agree.

> - use modern perl function call syntax:
> My::Package::function()
> instead of legacy perl 4 syntax:
> &My::Package::function()

I agree.

> - use block-based eval syntax:
> eval {
> require Foo::Bar;
> };
> instead of string-based syntax:
> eval "require Foo::Bar;"

I agree.

> - use plain english name for magic variables:
> use English qw(-no_match_vars)
> print $UID
> instead of:
> print $<
>
> Etc...

I want to add one thing to the list:

- use context-local variables as filehandles and directoryhandles:
open my $fh, '>', 'file';
print $fh 'blah blah blah';
close $fh;

Thanks for helpful inputs!

> What is the best way to first discuss those preferences first, to
> enforce them in the code second ?

--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/




Archive powered by MHonArc 2.6.19+.

Top of Page