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

Re: [PATCH] move zsh reserved words out of the way when invoked in sh/ksh emulation



On Mon, 26 Mar 2018 00:23:07 +0200
Martijn Dekker <martijn@xxxxxxxx> wrote:
> Meanwhile, I've identified five other reserved words that are unique
> to zsh *and* are perfectly plausible function names, so could kill an
> sh or ksh/bash script:
> 
> 	end
> 	float
> 	foreach
> 	integer
> 	nocorrect
> 
> So I think they (and 'repeat') should be disabled if zsh is invoked in
> sh or ksh emulation mode.

As far as I can see this isn't a particularly big deal as long a
properly documented seeing as "enable -r" works OK if people want
to mix code in emulation mode (in which case they can expect
to have the odd extra hoop to jump through).

> 'float' and 'integer' are part of the typeset family, so the
> underlying builtins would be exposed. It would then be inconsistent
> not to do the same with the rest of the typeset family:
> 
> 	declare
> 	export
> 	local
> 	readonly
> 	typeset
> 
> Thankfully, the KSH_TYPESET option still works. It should revert to
> being automatically enabled for ksh emulation and not for sh
> emulation, as in zsh up to 5.0.8.

This is when I got really confused when I first saw this patch.  This
breaks the syntax supporting inline parentheses present in POSIX mode
like any other and replaces it with what was always a kludge (though
does remain useful in certain cases), and furthermore doesn't have any
clear functional motivation.  So my eyes just glazed over.

pws



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