libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: function-local variables in ltmain


From: Gary V. Vaughan
Subject: Re: function-local variables in ltmain
Date: Tue, 16 Aug 2005 12:29:13 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20050305)

Hallo Ralf,

Ralf Wildenhues wrote:
Hi Albert,

* Albert Chin wrote on Sat, Aug 13, 2005 at 09:56:43PM CEST:

On Sat, Aug 13, 2005 at 10:40:01AM +0200, Ralf Wildenhues wrote:

Gary once mentioned a plan to emulate local variables in m4sh.

Indeed I did; and for exactly the reasons you enumerate below! Thanks for raising it again.

2) This looks somewhat ugly in the output, but to a certain extent, it
is possible to emulate local variables with m4sh: see below.

Way ugly.

Yep.

That doesn't matter. The output of gcc is ugly too! We should be maintaining the source files (.m4sh), and anything that makes them easier to read and edit is a good thing.

Just seems to make libtool harder to maintain.

Au contraire. Once any such mechanism has been debugged, it makes libtool easier to maintain... as has been the case with several of the refactorings I've done as we progress towards 2.0.

What's the point anyway? To keep function-specific variables from
being clobbered? Was this so much of a problem before libtool had
functions and everything was global? Seems like a solution looking for
a problem.

Well, I would like to modularize it more.  I am pretty sure it can be
made shorter and easier to understand that way.  (See func_execute_cmds
or func_source for example). For this, all-global variables are a
problem to some extent.

Agreed.

Just look at two examples: func_extract_archives uses variables named
my_*.  This is not safe: both its caller and any functions it may call
itself may overwrite these accidentally.  func_extract_an_archive OTOH
uses safe names f_ex_an_ar_*, but is ugly to the point of being
unreadable.

maintain an m4 map of function name to enumeration encoding, and name the local variables localxx_var_name if output ugliness is a big issue. On the principle of looking at the .m4sh files way more often than the generated libtool script, I don't think it is worth the trouble.

I do _not_ want to eliminate use of globals.  All I want is an easier
method for ensuring this than regular grepping of the whole script.
I'm certainly not determined to use this particular idea.

I am :-)  Eventually.  In my copious free time ;-)

Cheers,
        Gary.
--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]