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

Re: PATCH: Avoid using short_loops syntax in distributed files



On Aug 28,  8:57am, Mikael Magnusson wrote:
} Subject: PATCH: Avoid using short_loops syntax in distributed files
}
} nice if I could zcompile my $fpath without doing this:
} 
} setopt localoptions
} for dir in $fpath; do
}   if [[ $dir = /usr/* ]]; then
}     setopt shortloops
}   else
}     setopt noshortloops
}   fi
}   zrecompile -p $dir.zwc $dir/*(-.) && rm -f $dir.zwc.old
} done

Hmm, that's a shortcoming in zrecompile, is it not?  AFAICT it assumes
that everything you feed it is either in native zsh syntax, or in the
current emulation syntax.  It probably ought to have an option to name
the emulation mode, similar to autoload -z / -k, if nothing else.

There's also an argument that "autoload -z" ought to apply zsh sticky
emulation, rather than just determine whether or not the function has
to be explicitly re-executed after parsing.

For that matter, the whole keyword-hides-builtin scheme for typeset and
its synonyms breaks down if a function body is parsed with the reserved
words enabled but executed with them disabled, or vice-versa.  This does
not really differ from the long-standing behavior of aliases, but there
is "autoload -U" for that and nothing corresponding for reserved words.

This goes back to why "emulate -c string" performs an eval on the string.
In a different world, emulate/enable/disable would be evaluated at parse
time like perl "use".  But now I'm just rambling.



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