Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: bash-style substrings & subarrays



On Nov 20,  9:15pm, Peter Stephenson wrote:
} Subject: Re: PATCH: bash-style substrings & subarrays
}
} On Fri, 19 Nov 2010 10:01:45 -0800
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > On Nov 17,  4:54pm, Peter Stephenson wrote:
} > }
} > } This implements the ${NAME:OFFSET} and ${NAME:OFFSET:LENGTH} syntax.
} > 
} > I'm wondering whether :OFFSET:LENGTH shouldn't always use KSH_ARRAYS
} > semantics, or be a valid syntax only when KSH_ARRAYS is set?
} 
} I can see that if you interpret the word "OFFSET" literally it's
} different from a subscript and you might interpret it as starting
} from 0 in any case. I still think on balance consistency with normal
} subscripting is preferable.

I agree that consistency wth normal subscripting is preferable, but
subscripting behaves like a pair of offsets only when KSH_ARRAYS is
set (hence the second alternative I suggested).

However, I'm mostly indifferent.

} I don't think half-measures compatibility with other shells is
} particularly useful, in the end is probably more confusing when you
} find some things work the way you expect and some things don't.

I'm confused about how that relates to the foregoing, sorry ...?

Thanks for the additional patch.



Messages sorted by: Reverse Date, Date, Thread, Author