From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 543C31381F3 for ; Sun, 2 Jun 2013 08:39:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 63A74E0919; Sun, 2 Jun 2013 08:38:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6B96CE080A for ; Sun, 2 Jun 2013 08:38:56 +0000 (UTC) Received: from localhost (178-37-163-206.adsl.inetia.pl [178.37.163.206]) (using SSLv3 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 898CA33E0D2; Sun, 2 Jun 2013 08:38:54 +0000 (UTC) Date: Sun, 2 Jun 2013 10:39:32 +0200 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: gentoo-dev@lists.gentoo.org Cc: vapier@gentoo.org Subject: Re: [gentoo-dev] evar_push/pop helpers Message-ID: <20130602103932.759bee82@gentoo.org> In-Reply-To: <201306020329.34579.vapier@gentoo.org> References: <201306012303.21261.vapier@gentoo.org> <201306020309.31841.vapier@gentoo.org> <20130602091653.2da17286@gentoo.org> <201306020329.34579.vapier@gentoo.org> Organization: Gentoo X-Mailer: Claws Mail 3.9.1 (GTK+ 2.24.18; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA512; boundary="Sig_/UFZDcAEKPym9M8Z1OEcaZog"; protocol="application/pgp-signature" X-Archives-Salt: 2f1fb87d-ac27-4364-9eb3-2c52253c5f10 X-Archives-Hash: 3fa2b9f5357cdb3460046d7a1c8fe0ae --Sig_/UFZDcAEKPym9M8Z1OEcaZog Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Dnia 2013-06-02, o godz. 03:29:33 Mike Frysinger napisa=C5=82(a): > On Sunday 02 June 2013 03:16:53 Micha=C5=82 G=C3=B3rny wrote: > > Dnia 2013-06-02, o godz. 03:09:31 Mike Frysinger napisa=C5=82(a): > > > On Sunday 02 June 2013 02:51:34 Micha=C5=82 G=C3=B3rny wrote: > > > > Dnia 2013-06-01, o godz. 23:03:20 Mike Frysinger napisa=C5=82(a): > > > > > simple set of helpers to save/restore a variable in a limited sec= tion > > > > > of code > > > > >=20 > > > > > you can see an example of it in action at the end of the file whe= re i > > > > > need to tweak epatch (and no, doing `LC_COLLATE=3DC set -- ....` = does > > > > > not work). > > > >=20 > > > > Why the ugly hackery instead of proper 'local' scope? > > >=20 > > > there's no way to undo the local thus it affects the rest of the func= .=20 > > > this makes sure the change is actually localized to where it is neede= d. > >=20 > > By use of global variables and a bunch of additional code and evals. >=20 > the implementation details of estack_* doesn't matter It's not beautiful language with proper local scopes, so it *does* matter. > > Is: > >=20 > > local _epatch_foo=3D${foo} > > local foo > > ... > > foo=3D${_epatch_foo} > >=20 > > really that hurtful? >=20 > except you aren't handling edge cases (like set vs unset), and i've repli= cated=20 > this pattern before (in fact, you've filed bugs where the set/unset case = wasn't=20 > handled). API 101: implement it once correctly to simplify everyone else. Edge cases matter where they actually matter. Inventing use cases just to prove we need something doesn't help anyone. And we can't implement it correctly since we're talking about bash. Bash doesn't provide means to implement it correctly. > > Also, do you really want the collation to be changed only in this one > > place? This looks weird to me. >=20 > yes, i only want to force it here, because it's the only place where coll= ation=20 > matters in the func currently. So, effectively, changing it once in the beginning of the function would be simpler and wouldn't cost anything. >=20 > > Much like fixing tiny bug and trying to > > avoid checking whether anything else is affected. >=20 > yeah, because forcing specific behavior for an entire function is always = the=20 > correct answer. it's like telling people to export LC_ALL=3DC in make.co= nf so=20 > they never hit locale related problems. Feel free to try that. But on yourself, not our users. Or just grep bugzie. --=20 Best regards, Micha=C5=82 G=C3=B3rny --Sig_/UFZDcAEKPym9M8Z1OEcaZog Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQJ8BAEBCgBmBQJRqwTEXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ1RUJGMjBGOTk2RkIzQzIyQ0M2RkNBNDBC QUJGMUQ1RkY4QzgxMTBBAAoJELq/HV/4yBEK6+AQAJ8XXZ9jz0lp9ogKoaKg2V/i fzwTPZxi+Oq79qCM79z/QMByFNCYqHi7Dss+PHLJwFNcOPfRF46cLpdZKQ3sMFFT HBfWx1bNUuT9G7ZeZGKyCPeA3quk0SCbW7QU9AZupOBnSPAJg+v8S8zZuBvq1vVq JrDhalgbyKJgv5l4r/gvIw9ARg8htwpi9FIh3a5bUfrE7EgujwUNtNFEv+BEiyNq 2kJ7FfxAiMMAxDZ49J0k/XC0kBl3TdlZmI5BanTlm4wgCbK0c1WwjlSzP1hMcGu1 OqbEmxpDU7AriLV730Ad9Zg+EHTEFnTua4UZpLHn4SMj2RgEvBNDzbQGkQ0TPAFv Wo/SmfsrXsgbUHS7bAMii7RKTWxjKEKdv62KlKvB19ALULQx9CRdeXGj2SLfMQfD WA+kGF7EIGIv/uRAPdMqml7X1FPz7NstW8Qrfp/ZAQZCy61YN3dlnNupLGM6nODC Qe6OGWbLkCRPRuTvVTK5mKv/xKKQtZvvFkeq3xV02WqWlJvpYuerKiHGFcU/5W/U UVNangXWvN5/qd6xoIHz6qJd0Spu+cDuxbg7Q4FvK4s2SM81xLOYta3GrAumcWYL itUSBlLPKeB2qCNXS89DqbvSPwP+PMSODgWjMeFrcU/tXflsJtXmbUr8CHudEq9u WJzfQd1e7IS36F2W0UO+ =mTIJ -----END PGP SIGNATURE----- --Sig_/UFZDcAEKPym9M8Z1OEcaZog--