Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] Why autodie?

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Marc Chantreux <address@concealed>
  • To: David Verdin <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [sympa-developpers] Why autodie?
  • Date: Wed, 21 Feb 2018 16:32:23 +0100

hello David,

On Wed, Feb 21, 2018 at 10:37:02AM +0100, David Verdin wrote:
> > betting on XML to exchange things. a foreach/push combo was thought
> > "much more readable" than a map/grep expression.
> Then again, I don't know many people thinking that that a grep/map is easier
> to read than procedural.

I have to admit this strong feeling i have came from the evolution of
what i saw, read and heard during 20 years: i have no data to back it up
(data should be compiled to be usable). But if you look at langages that
are actually rising or currently popular, most of them emphasize the use
of lambdas and the ability to combine them (even java and C++ finally
get them).

As i'm a old fan of the this kind of code, i can also argue it is
easier to write and read because it gives plenty of informations

my @new_commers =
grep { $_->since->year > 2017 }
@users;

* the first line tells you we're going to fill a list
* grep tells you that it's a subset

when the following code gives you no information at the first look

my @new_commers;

for (@users) {
$_->since->year > 2017
and push @new_commers,$_
}

As i said: i have no serious data but i really would like other
developers to share about it.

> > $list += $subscriber
> >
> > instead of
> >
> > $list->add_subscriber( $subscriber )
> Not from where I stand.
> I think the second form is way more readable, in addition to being
> consistent with $list->update_subscriber(), $list->get_subscriber(), etc.

fair enough your honor, i retire this demand.


> > Sympatic is just a "put it all together" module to have all those
> > goodness from a single line.
> Not really. What Sympatic does is including modules, mainly.
> What you propose is enforcing a coding style. these are two different
> things.

Sympatic is about providing tools so we can get a coding style and i
think we have to document it without telling every developers to read
the whole modules documentations.

> > > However, I don't understand how it is used.
> > I started to write a guide that will be online ASAP
> And everybody can read already the readme in
> https://github.com/sympa-community/p5-sympatic
> A lot of things are discussed here.

thanks for pointing it out. also

https://github.com/sympa-community/p5-sympatic/blob/master/lib/Sympatic.pod

is a starting note on the documentation i started

> > > First of all, I'd like to see how it is used in the practical code.
> > Sure: i'll use it in the sympa7 branch so people could have a better
> > insight on real world usage of sympatic.

> Except that if they don't read any guidelines, they won't know what "method"
> means.

i did a "blind test" with non-perl colleages so i have to admit my panel
isn't that large but the interesting fact is: for a perl newbie, it is
much simple to guess what the method keyword is than to understand that
perl comes by default only with variadic functions and @_ are the
arguments.

> > autodie, i made some try with Carp::Always and it works like a charm
> > (i previously used Devel::SimpleTrace which was an inspiration for
> > Carp::Always).
> what is the NIH syndrom?

can't say better than Alexandre on it :)

> >
> > > On the other hand, if autodie aims to implement exception-oriented
> > > programing style, it is very unsatisfactory implementation, I think.
> > > I once have tried implement more with autodie. However I don't
> > > want to use such thing.
> > > See:
> > > https://listes.renater.fr/sympa/arc/sympa-developpers/2013-10/msg00010.html
> > why not using well crafted and documented stuff available on CPAN?
> > there is no gain to write your own one.

> Except it is already there and working.
> On my opinion, replacing a module with CPAN must come with an added value.

added values of CPAN:

* maintained for free
* documented for free
* well tested for free
* well known by others

> > * you haven't described yet what's wrong with exception handling?
> Soji agrees with exception handling.
> He just does not agree with autodie. That's what he did not want to use
> again.

ok. i give away autodie in the next release

regards
marc




Archive powered by MHonArc 2.6.19+.

Top of Page