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

Re: zsh ignores the arguments on its first command.



On Wed, 2 Jun 2010 09:44:13 -0700
Martin Buchholz <martinrb@xxxxxxxxxx> wrote:
> I was thinking that, in addition,
> the construct ${+NAME}
> should never cause "unknown parameter",
> not even due to failure to load a module
> that provides the parameter as a feature,
> so an additional fix in the zsh core might be good.
> If a module fails to load, NAME should become an
> ordinary unset variable, and ${+NAME} should be 0.

I don't think that can be right.  You're basically asking for all (or a
substantial subset of) autoload failures to be silent.

To me, the module autoload is a contract that when you reference the
variable the module *will* be loaded.  If it isn't that's an error.  Take
the present example: the module failed to load because of an error that (so
far as I know) we're not interested in.  If this instead failed silently
the user would simply know that $terminfo wasn't working despite the fact
they've (maybe implicitly) asked for it and not have a clue why or even
that something had failed and hence wouldn't know what to do about it.

The autoload interface is a convenience to avoid you having to load modules
explicitly, which deliberately doesn't expose the module layer directly, so
necessarily interacts with it simply (load the module on demand, and that's
it).  If you're paranoid about not having module loads fail you need to do
more at the zmodload level.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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