Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: string range between 1 and 0.
- X-seq: zsh-workers 7187
- From: Tanaka Akira <akr@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: string range between 1 and 0.
- Date: 19 Jul 1999 10:01:29 +0900
- In-reply-to: "Bart Schaefer"'s message of "Mon, 19 Jul 1999 00:02:59 +0000"
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <rsqvhbi7fww.fsf@xxxxxxxxxxxxxxxxx> <990719000259.ZM8741@xxxxxxxxxxxxxxxxxxxxxxx>
In article <990719000259.ZM8741@xxxxxxxxxxxxxxxxxxxxxxx>,
"Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> This is a side-effect of ksh array compatibility, believe it or not.
Hm.
> So, given the choices
> (1) leave it as is
> (2) treat [n,0] as [n,-1]
> (3) treat [n,0] as an error
> my own preference is for (1).
I encount this problem with the code such as:
region="$buffer[pos1,pos2]"
I represent a region by pos1 and pos2.
To represent null region, I assign pos2 to pos1 - 1.
I think it's natural, but it's not works when pos1 is 1.
So, my preference is "treat [n,0] as null string if 0 < n".
However, it is no ploblem with the code such as:
local tmp=" $buffer"
region="$tmp[pos1 + 1, pos2 + 1]"
But, I think it's ugly.
Is there exists a more smart code?
# For example, is it representable with only variable expansion?
--
Tanaka Akira
Messages sorted by:
Reverse Date,
Date,
Thread,
Author