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

Re: PATCH: bash-style substrings & subarrays



Bart Schaefer wrote:
> } 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 ...?

If KSH_ARRAYS is not set, lots of aspects of arrays don't work in a
fashion consistent with other shells, so the fact that one feature you
chanced upon does so, doesn't help you write scripts properly.  If you
want proper compatibility you need a full emulation.

This doesn't impinge on the argument for saying the newly imitated
syntax only deals with offsets and for that reason shouldn't be affected
by KSH_ARRAYS, however.  I'd be happy to get any other views.  Should
${foo:1} always start 1 character/element beyond the first one,
regardless which subscripting rules are in use?  I'm now inclining in
that direction.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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