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

Re: Emulation and NUMERIC_GLOB_SORT



Bart Schaefer wrote:
>However, now that I think of it, globbing order is already going to be
>altered by LC_COLLATE, so scripts that rely on it are out of luck in
>the first place.

Erk.  I hope that's not POSIX.  I think we should probably remove that,
just as we removed it from character ranges, and for exactly the same
reason that we want NUMERIC_GLOB_SORT to be reset by emulation.

Fundamentally, I view globbing as a programming feature, which should
be utterly unaffected by locale.  Same for string comparisons in [[]].
I think we do want a locale-dependent string comparison operation, but
its use is very much the exception, not the rule.  Pattern matching and
string comparisons are used on all sorts of strings, and only very rarely
on natural-language text.

Exactly the same argument applies to numeric syntax; the use of "." as
the decimal point is part of the language syntax, and should not be
locale-dependent.  A builtin that could take a number in standard syntax
and render it in locale-dependent syntax would be nice.[1]

If use of LC_COLLATE in globbing is POSIX (and maybe even if it's not),
we could reasonably make that another option, which would itself be
affected by emulate (and I'd argue that it should be off by default in
all current emulation modes).

-zefram

[1] That reminds me, one of the things I never got round to implementing
as a builtin was the POSIX "printf" utility.  The advantage of having
it as a builtin is that we could then use the same code for a "sprintf"
builtin, which would put the result into a shell variable instead of
sending it to standard output, which is a feature I often miss.



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