Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: vapier@g.o
Subject: Re: [gentoo-dev] evar_push/pop helpers
Date: Sun, 02 Jun 2013 07:16:24
Message-Id: 20130602091653.2da17286@gentoo.org
In Reply to: Re: [gentoo-dev] evar_push/pop helpers by Mike Frysinger
1 Dnia 2013-06-02, o godz. 03:09:31
2 Mike Frysinger <vapier@g.o> napisał(a):
3
4 > On Sunday 02 June 2013 02:51:34 Michał Górny wrote:
5 > > Dnia 2013-06-01, o godz. 23:03:20 Mike Frysinger napisał(a):
6 > > > simple set of helpers to save/restore a variable in a limited section of
7 > > > code
8 > > >
9 > > > you can see an example of it in action at the end of the file where i
10 > > > need to tweak epatch (and no, doing `LC_COLLATE=C set -- ....` does not
11 > > > work).
12 > >
13 > > Why the ugly hackery instead of proper 'local' scope?
14 >
15 > there's no way to undo the local thus it affects the rest of the func. this
16 > makes sure the change is actually localized to where it is needed.
17
18 By use of global variables and a bunch of additional code and evals.
19
20 Is:
21
22 local _epatch_foo=${foo}
23 local foo
24 ...
25 foo=${_epatch_foo}
26
27 really that hurtful?
28
29 Also, do you really want the collation to be changed only in this one
30 place? This looks weird to me. Much like fixing tiny bug and trying to
31 avoid checking whether anything else is affected.
32
33 --
34 Best regards,
35 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] evar_push/pop helpers Mike Frysinger <vapier@g.o>