Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Treatment of illegal indices
- X-seq: zsh-workers 3782
- From: Peter Stephenson <pws@xxxxxx>
- To: Bernd Eggink <eggink@xxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: Treatment of illegal indices
- Date: Mon, 23 Feb 1998 10:23:21 +0100
- In-reply-to: "Bernd Eggink"'s message of "Sun, 22 Feb 1998 16:07:40 MET." <34F03F3C.5FFA09E@xxxxxxxxxxxxxxxxxx>
Bernd Eggink wrote:
> The way zsh treats illegal array indices is pretty ugly. It simply
> replaces indices which are 0 (with KSH_ARRAYS unset) or < -length by 1.
>
> Possible improvements could be:
>
> c) Print an error message if an illegal index is used on the left
> side of an assignment, return an empty value otherwise.
I think this is better; it's fairly standard for interpreted languages.
The `feature' that 0 is treated as 1 has been around for a long time,
but since KSH_ARRAYS it's probably time it went. You are supposed to
be able to extend arrays by assignment, remember: some time ago there
was an argument about whether
23456789=''
using up a lot of memory was a bug, and it was decided it wasn't.
--
Peter Stephenson <pws@xxxxxx> Tel: +39 50 911239
WWW: http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author