zsh-workers
 help / color / mirror / code / Atom feed
* ARGC (and other readonly specials) and "local"
@ 2001-03-17 17:10 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2001-03-17 17:10 UTC (permalink / raw)
  To: zsh-workers

This is 4.0.1-pre-2:

zsh% ARGC=0
zsh: read-only variable: ARGC
zsh% argc () { echo $ARGC; local -i ARGC; ARGC=0; echo $ARGC }
zsh% argc a b c
3
3

So even though I can make it local and thereby not read-only, it still
behaves as if it were read-only.

This is of course what "local -h" is for.  However:

zsh% argc () { echo $ARGC; local -Z3 ARGC; ARGC=0; echo $ARGC }
zsh% argc a b c
argc:local: ARGC: can't change type of a special parameter

If I can't change any other attributes, why should I be able to change
readonly?

BTW, I found this interesting:

zsh% typeset -i2 ARGC
zsh% echo $ARGC
2#0

So *some* attributes can change, even of readonly parameters.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-03-17 17:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-17 17:10 ARGC (and other readonly specials) and "local" Bart Schaefer

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).