Subject: Developers of Sympa
List archive
- From: IKEDA Soji <address@concealed>
- To: David Verdin <address@concealed>
- Cc: address@concealed
- Subject: Re: [sympa-developpers] Why autodie?
- Date: Mon, 19 Feb 2018 19:26:05 +0900
David and all,
I think Sympatic is a sort of syntax suger, syntax suger is useful
and I'll accept anything reasonable.
However, I don't understand how it is used. I can't neither disagree
nor agree to what I havn't understood. First of all, I'd like to see
how it is used in the practical code.
Comments at the moment follows.
On Mon, 19 Feb 2018 09:41:55 +0100
David Verdin <address@concealed> wrote:
> Dear all,
>
> Soji just asked on the Sympa discussion channel why eiro wants to use
> autodie.
>
> I'll try an answer here.
>
> First: Sympatic: The idea of Sympatic is to give future developers a
> boilerplate: include all modules that should be used wherever in Sympa.
> So adding "use Sympatic;" includes a bunch of modules; adding "use
> Sympatic -oo" includes the same modules plus Moo.
At first, I also thought it is nice to gather several pragmatic
modules into one line, but afterward, I began douting.
The changes this module will bring are non-trivial: People beginning
to read the code cannot be aware that accessor can be defined using
"has", function using "fun" or "method", ... and especially,
Perl builtin functions can suddenly die. They will be aware only
after reading Sympatic.pm and finding Moo, Function::Parameter and
autodie.
To audit, read or modify the code, it seems not always true that
hiding pragmatic modules is convenient way: People cannot touch the
code without reading the "user manual" of Sympatic module, in
addition to the code itself.
However, common boilerplate is useful. At the moment I suppose we
may agree to use some modules obligatorily (as all programs use
"strict" and "warnings" pragma now).
> Second: autodie. it's included in Sympatic. Using this modules will
> raise a die whenever the code can't succeed. eiro's argument is to make
> sure an exception will be raised whenever the code does not behave as
> intended.
>
> The argument in favour of this module is the decreasing number of lines
> to maintina to raise exceptions.
I don't understand why lazy programmers are punished by death of
program. Honestly, I feel it hardly pays.
Moreover, I currently understand that, to avoid this punishment,
programmer have to write code not only checking result of function
but also additional code preventing penalty: For example, we could
simply write
| unless (open $fh, '<', $file) {
| ...
| }
but autodie looks requesting more.
Possiblly I'm wrong. If there is simple way with autodie, please tell
me. Please.
> The argument against it, in my opinion, is that, when reading a piece of
> code, we won't know that an exception can be raised in that exact place.
> I think we should maintain a minimum level of hand-made exceptions with
> explicit exception typing to be able to handle them correctly; the idea
> is that, in some cases, exceptions should make Sympa die, and in other
> cases it should not.
Currently, Sympa::Crash generates traceback and "uncaught
exceptions" can be tracked.
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
> What is your opinion on this?
>
> Regards,
>
> David
>
> --
> "Mieux vaut viser la perfection et la rater que viser la médiocrité et
> l'atteindre."
> - Francis Blanche
>
>
--
株式会社 コンバージョン
ITソリューション部 システムソリューション1グループ 池田荘児
〒140-0014 東京都品川区大井1-49-15 アクセス大井町ビル4F
e-mail address@concealed TEL 03-6429-2880
https://www.conversion.co.jp/
-
[sympa-developpers] Why autodie?,
David Verdin, 02/19/2018
-
Re: [sympa-developpers] Why autodie?,
IKEDA Soji, 02/19/2018
- Re: [sympa-developpers] Why autodie?, David Verdin, 02/20/2018
-
Re: [sympa-developpers] Why autodie?,
Marc Chantreux, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
IKEDA Soji, 02/21/2018
- Re: [sympa-developpers] Why autodie?, IKEDA Soji, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
David Verdin, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
Alexandre Franke, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
David Verdin, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
Stefan Hornburg (Racke), 02/21/2018
- Re: [sympa-developpers] Why autodie?, David Verdin, 02/21/2018
- Re: [sympa-developpers] Why autodie?, Stefan Hornburg (Racke), 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
Stefan Hornburg (Racke), 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
David Verdin, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
Alexandre Franke, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
IKEDA Soji, 02/21/2018
-
Re: [sympa-developpers] Why autodie?,
IKEDA Soji, 02/19/2018
Archive powered by MHonArc 2.6.19+.