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

Re: autoload



On Sep 13,  8:34pm, Ray Andrews wrote:
} Subject: Re: autoload
}
} On 09/13/2015 07:38 PM, Bart Schaefer wrote:
} > Would it make more sense written like ${^fpath} ?  It's the operator
} > that causes an array (a b c) to expand to e.g. a/* b/* c/* instead of
} > to a b c/* -- cf. the rc_expand_param setopt.
} Yikes, that's brand new to me, I only know the caret as negation. So 
} this is a feature
} specific--it seems--to getting useful path expansion.

No; it happens to involve path expansion in the specific example of
appending /* to every element of $fpath, but that's not really what
it means.  The second paragraph of the doc is useful:

${^SPEC}
     Turn on the RC_EXPAND_PARAM option for the evaluation of SPEC; if
     the `^' is doubled, turn it off.  When this option is set, array
     expansions of the form FOO${XX}BAR, where the parameter XX is set
     to (A B C), are substituted with `FOOABAR FOOBBAR FOOCBAR' instead
     of the default `FOOA B CBAR'.  Note that an empty array will
     therefore cause all arguments to be removed.

     Internally, each such expansion is converted into the equivalent
     list for brace expansion.  E.g., ${^var} becomes
     {$var[1],$var[2],...}, and is processed as described in *Note
     Brace Expansion:: below.  If word splitting is also in effect the
     $var[N] may themselves be split into different list elements.

} > (N) means nonomatch, so empty directories disappear from the result
} > instead of causing a globbing error.  (-) is follow symlinks, so that
} > combined with (N) any dangling symlinks also disappear.  These both are
} > documented in the "Glob Qualifiers" subsection of the manual.
} 
} Nuts, I scanned that page top to bottom looking at random, and there
} it is near the very bottom. 'NULL_GLOB' it says. Thanks for the
} explanation.

Yeah, I thinko nonomatch for nullglob periodically, don't know why.

}      autoload n-list n-cd n-env n-kill n-panelize n-options n-aliases 
} n-functions n-history n-preview
} 
} ... is actually more 'honest' since all autoload really knows at that 
} point is names.  Definitions will be retrieved later. Yes?

Yes.

} > (zcompile on the other hand DOES load from locations rather than from
} > a path search, so if you use zcompile + autoload -w you get the path
} > stripping.)
} >
} Sounds like a good idea, would that not be preferable?  Why not prime 
} the pump with both the name and the location?

Compatibility with the implementation chosen by other shells that had
autoloading earlier, mainly.  Less importantly, for .zshrc portability,
so you can autoload things without having to find them yourself in the
fpath first.  The inverse -- wanting to autoload a bunch of things
you know are in the fpath without knowing their function names -- was
not really contemplated as a common case when the command was invented.



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