Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
ARGC (and other readonly specials) and "local"
- X-seq: zsh-workers 13656
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: ARGC (and other readonly specials) and "local"
- Date: Sat, 17 Mar 2001 17:10:18 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author