This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: automake and 'strict' Perl5


Matthew D. Langston wrote:
> Since you didn't post your patch I wasn't able to fully appreciate your
> changes.  Perhaps it is a large-ish patch (it sounded like it might be),
> which may be why you decided not to post it.  In any event, I had a few
> questions and comments concerning it.

A patch does not really make sense. In fact, you need the whole
file. I send a compressed one to you separately (54k).
[BTW, Tom, do you want it?]
Anyway, this file is out of sync with the CVS version, so it is
merely useful for discussion.

> Lexically scoping automake's variables is a good thing.  It needed to be
> done, and we all knew that it should be done, but it was a big project
> to do correctly.  Thank you for undertaking this.

You are welcome.
As I said, I probably introduced several major bugs. This job surely
is not finished yet. But surprisingly, it was not so hard. Most
variables used are either globals or true local variables (in the C
sense, ie: lexical variables in Perl terminology). It's just cumbersome,
and you _really_ need the test suite (I don't know who wrote that,
but he/they deserve a big thank you).

> However, I am not so keen on "Perl function prototypes".  You mentioned
> that you prototyped *all* of automake's functions, but I believe this
> may do more harm than good in the long run.

[I don't quote your discussion.]

 All the points you raise are generally true. Furthermore, as
a Perl programmer, I usually tend to agree with everyone. ;-)

There is a check on the number of arguments when prototypes
are provided and 'use strict;' is enabled. And also a basic
check on parms type (scalar, list).
This is mainly why I introduced them. It was mainly for me,
to help me maintain the integrity of the overall program
while doing these modifications everywhere.
[Of course, I accidentally erased a parameter somewhere at
some point (especially during the last part of the night)
and the prototype hints found that typos. That was useful.
Really.]

I don't know if these prototypes can have real bad side-effects
(in fact, even though I'm aware of such potentially ill behavior,
I've never observed it in real-life scripts). I tend to view
them as a kind of comment, that happens to be understood by the
perl interpreter - something that it sometimes confess to the
user.

In that sense, protos. can be really useful, as a mean to check
a function call. That's how I see them. Finally, Perl usually
takes a lot of care not to harm programmers - especially those
that follow the native guidelines. So, I would really be surprised
if these prototypes caused any harm in the long run.

In that case, as you say, I would simply erase them. But until
such situation occur, why not use them? These prototypes can
spot typos automatically. I like that. [Maybe because I have
to switch between a QWERTY keyboard at work and an AZERTY at
home... :-)]

> Additionally, Perl function prototypes are useless when writing OO
> modules, which is more than likely the direction that Automake is
> heading.

Currently yes. That's true. The prototype is merely ignored in
that case (and also when a function is called via a &$func_ref(...)
dynamically resolved call) and remains only as a kind of comments.
Well, as you say, these are not true function prototypes. But
I see that as a pro. (They are not prototypes, they are useful.)


As you see, all in all, it seems this topic can be rather
controversial. (Because, even while agreing with you, I'd
still be tempted to add prototypes...)
I don't really think prototypes can be annoying - and I'd say
that they can be useful and they can be removed (easily), so...
But well, there is no need to start an endless discussion, both
of us will find good reasons to do opposite things...

In the meantime, I'd rather have feedback from you concerning the
bashing I did to the automake script - if you have some time to
have a look at it. Just to know if the program is still
alive or if it has been the poor victim of a huge medical error.

Dr. Rodolphe ;-)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]