W3C home > Mailing lists > Public > xproc-dev@w3.org > November 2011

RE: Shadowing of variables..

From: Geert Josten <geert.josten@dayon.nl>
Date: Mon, 28 Nov 2011 11:30:22 +0100
Message-ID: <bb8ca8ce688ede99877be4fbaac5e628@mail.gmail.com>
To: Florent Georges <fgeorges@fgeorges.org>
Cc: vojtech.toman@emc.com, xproc-dev@w3.org
Good point.

I usually redeclare variables if I want to build a final value in multiple
steps, to make either calculation easier (reusing intermediate values
multiple times in one expression), or just to decompose an otherwise very
long calculation.

Kind regards,

PS: what are the use cases for XSLT? ;-)

-----Oorspronkelijk bericht-----
Van: fgeorges@gmail.com [mailto:fgeorges@gmail.com] Namens Florent Georges
Verzonden: maandag 28 november 2011 11:22
Aan: Geert Josten
CC: vojtech.toman@emc.com; xproc-dev@w3.org
Onderwerp: Re: Shadowing of variables..

On 28 November 2011 11:12, Geert Josten wrote:


> I see no obvious reason why to be picky about it, and require
> developers to use a p:group to shadow a variable..

> But perhaps that is just my pragmatic way of looking at it.. ;-)

  My pragmatic way of looking at it is that this prevents the compiler
to detect what is most likely an error.  I never use two variables
with the same name *at the same scope level*, and if I do that's a
typo and I want the compiler to tell me so.

  Just curious, what's the use case exactly requiring shadowing a
variable at the same level?


Florent Georges
Received on Monday, 28 November 2011 10:30:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:03:09 UTC