zsh-workers
 help / color / mirror / code / Atom feed
* Local variable declaration in loops buglet...
@ 2003-11-05  0:06 Philippe Troin
  2003-11-05  4:08 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Troin @ 2003-11-05  0:06 UTC (permalink / raw)
  To: zsh-workers

Just found this one:

  % zsh -f
  ceramic% echo $ZSH_VERSION
  4.0.6
  ceramic% foo() { for i in 1 2 3; do local x; x=$i;done }
  ceramic% foo
  x=1
  x=2
  ceramic% 

Moving the local out of the loop fixes the echo of course... But I do
not think it should matter.

Phil.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Local variable declaration in loops buglet...
  2003-11-05  0:06 Local variable declaration in loops buglet Philippe Troin
@ 2003-11-05  4:08 ` Bart Schaefer
  2003-11-05  6:53   ` Philippe Troin
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2003-11-05  4:08 UTC (permalink / raw)
  To: zsh-workers

On Nov 4,  4:06pm, Philippe Troin wrote:
}
}   ceramic% foo() { for i in 1 2 3; do local x; x=$i;done }
} 
} Moving the local out of the loop fixes the echo of course... But I do
} not think it should matter.

This is not a bug, it's documented behavior of `typeset' for which
`local' is an alias:

    For each remaining name that refers to a parameter that is set,
    the name and value of the parameter are printed in the form of an
    assignment. Nothing is printed for newly-created parameters, or when
    any attribute flags listed below are given along with the name.

In 4.1.1-dev, you can `setopt typeset_silent' to suppress this.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Local variable declaration in loops buglet...
  2003-11-05  4:08 ` Bart Schaefer
@ 2003-11-05  6:53   ` Philippe Troin
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Troin @ 2003-11-05  6:53 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer <schaefer@brasslantern.com> writes:

> On Nov 4,  4:06pm, Philippe Troin wrote:
> }
> }   ceramic% foo() { for i in 1 2 3; do local x; x=$i;done }
> } 
> } Moving the local out of the loop fixes the echo of course... But I do
> } not think it should matter.
> 
> This is not a bug, it's documented behavior of `typeset' for which
> `local' is an alias:
> 
>     For each remaining name that refers to a parameter that is set,
>     the name and value of the parameter are printed in the form of an
>     assignment. Nothing is printed for newly-created parameters, or when
>     any attribute flags listed below are given along with the name.
> 
> In 4.1.1-dev, you can `setopt typeset_silent' to suppress this.

Oops. Did not know this behavior. Sorry for the noise.

Phil.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-05  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05  0:06 Local variable declaration in loops buglet Philippe Troin
2003-11-05  4:08 ` Bart Schaefer
2003-11-05  6:53   ` Philippe Troin

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).