RE: Shadowing of variables..

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,
Geert

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:

  Hi,

> 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?

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

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