zsh-workers
 help / color / mirror / code / Atom feed
* Re: Problems with the functions[] parameter
@ 2000-03-10  9:49 Sven Wischnowsky
  2000-03-10 12:03 ` Problems with the functions[] parameter (not; but other issues) Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2000-03-10  9:49 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> I think that wordcode storage of functions has messed up the function[]
> assoc from the parameter module.  The value of functions[something] no
> longer accurately reflects the current state of the function `something'
> and assigning to (or using vared on) functions[something] no longer
> changes the definition of `something'.

Seems to work fine for me both with read and mapped wordcode
files... could you give me an example?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Problems with the functions[] parameter (not; but other issues)
@ 2000-03-10 12:45 Sven Wischnowsky
  2000-03-11 18:14 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2000-03-10 12:45 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
> 

Interestingly, I just found the same two things, when changing
_diff_options.


> Which leads me to two observations ...
> 
> (1) autoloading the _call function (for example) is inefficient; it is
>     never used except in $(...), which means it is reloaded every time.
>     Would it be useful to use e.g.
> 
>     	#autoload +X
> 
>    at the top of such files?  To mean, "load this as soon as compinit
>    sees it, don't wait for it to be executed via $fpath."  (But what
>    would that mean for compdump?)

Yes, compdump is a problem, nice as it would be. I see only two ways:
make compinit/the-dump-file record the #autoloaded functions with the
options to #autoload in some array/assoc or add a naming convention
for files that are to be loaded immediatly. The first one would
support the nice `#autoload +X' you suggest and the latter would allow 
to get `#compdef' files loaded immediately without having to add an
extra option to compdef. Dunno if that's interesting to have for
#compdef files, though.

> (2) Redirecting stderr of a function is a bit inconsistent with respect
>     to xtrace.  Zsh presently works the same way bash does, which means
>     the xtrace output of shell functions is *not* redirected along with
>     their stderr.  This is not the same as e.g. `do'-loops and { ... }.

What really irritated me here (and it still looks wrong): add

  set -x
  _call version diff -v </dev/null 2>/dev/null
  set +x

to, say, _diff_option, then do `diff <TAB>'. At least I get:

  _diff_options:8 (): _call version diff -v
  _call:3 (): local tmp
  diff - GNU diffutils version 2.7-97r1
  _diff_options:9 (): set +x

Only the `first' line of _call is shown, xtrace output stops when
zstyle is called. Or maybe my exec.c is out-of date, because:

> And (2) in turn leads me to notice a third thing:
> 
> In bash, redirecting the standard error of the `.' command redirects
> the xtrace output from the commands in the sourced file.  This doesn't
> presently happen in zsh, but I think the zsh behavior is more useful;
> other opinions?  Is compatibility more important?  What does ksh do?

if I do `. ./foo 2> bar' I get the xtrace output of the commands in
`foo' in `bar'. Same as for the ksh I have here, btw.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-03-11 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-10  9:49 Problems with the functions[] parameter Sven Wischnowsky
2000-03-10 12:03 ` Problems with the functions[] parameter (not; but other issues) Bart Schaefer
2000-03-10 12:45 Sven Wischnowsky
2000-03-11 18:14 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).