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 CCBB21381F3 for ; Sun, 2 Jun 2013 07:36:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8EBB9E08ED; Sun, 2 Jun 2013 07:36:05 +0000 (UTC) Received: from gerard.telenet-ops.be (gerard.telenet-ops.be [195.130.132.48]) by pigeon.gentoo.org (Postfix) with ESMTP id 5F2ACE0825 for ; Sun, 2 Jun 2013 07:36:04 +0000 (UTC) Received: from TOMWIJ-GENTOO ([94.226.55.127]) by gerard.telenet-ops.be with bizsmtp id jKc21l00i2khLEN0HKc2U7; Sun, 02 Jun 2013 09:36:03 +0200 Date: Sun, 2 Jun 2013 09:33:36 +0200 From: Tom Wijsman To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] evar_push/pop helpers Message-ID: <20130602093336.70c17b51@TOMWIJ-GENTOO> In-Reply-To: <201306020309.31841.vapier@gentoo.org> References: <201306012303.21261.vapier@gentoo.org> <20130602085134.40151bd2@gentoo.org> <201306020309.31841.vapier@gentoo.org> X-Mailer: Claws Mail 3.9.0 (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-SHA1; boundary="Sig_/4IkGrw8bCcdyT5upMrSPQlD"; protocol="application/pgp-signature" X-Archives-Salt: 8fca5fee-c9be-4ec6-916d-09be8f0e8eb5 X-Archives-Hash: c2f8d50e4ce39304e49af1ee7753e113 --Sig_/4IkGrw8bCcdyT5upMrSPQlD Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 2 Jun 2013 03:09:31 -0400 Mike Frysinger wrote: > there's no way to undo the local thus it affects the rest of the > func. this makes sure the change is actually localized to where it > is needed. -mike In other languages you can freely introduce local scopes { ... }, this isn't possible in Bash since a local corresponds to a function; but it's not really that hard to replicate, now consider this instead: test() { local test=3D"FUNCTION" echo ${test} x(){ local test=3D"LOCAL SCOPE 1" echo ${test} };x echo ${test} x(){ local test=3D"LOCAL SCOPE 2" echo ${test} };x =09 echo ${test} } test Now 'x' is vague, you could replace 'x' by a name documenting the scope. I consider this to be more clean than using a variable to remember it, especially when multiple local scopes are to be used after each other. --=20 With kind regards, Tom Wijsman (TomWij) Gentoo Developer E-mail address : TomWij@gentoo.org GPG Public Key : 6D34E57D GPG Fingerprint : C165 AF18 AB4C 400B C3D2 ABF0 95B2 1FCD 6D34 E57D --Sig_/4IkGrw8bCcdyT5upMrSPQlD Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQEcBAEBAgAGBQJRqvVcAAoJEJWyH81tNOV9hxMH/1U/Qd07wyB1lqYSGfrxUPoo hvyylrXQS+ooVQpSU6Rz+kS9tee/byZjJquvn9E7KOcsJdkEiOs4nPFtLYbNbTJ4 tM1/Ef9dnUlIWLITVvHZHRCSxEfpPBj4oToPpUoVqrnhObd/u3uu0ZgxTxY3rZgz RwCE/O1tqMxNZUYi8pbzcJbS1zstJaeMKNsedzmQcjktfMeNDiGtU910+gLcKEPw Bpuhu1OBn8erjc87VNafcPottDHrkTWKMZmdlCD+X0rntWzDlqlDJeTottYMgYs1 8zNbIaRWa/V6lMOVHS7XPNiiVFqqCQw2PC8/eSPZWx+SmJPdxth20QZGU7UB+RI= =YGC4 -----END PGP SIGNATURE----- --Sig_/4IkGrw8bCcdyT5upMrSPQlD--