From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>,
zsh-workers@sunsite.auc.dk
Subject: Re: endianness of wordcode
Date: Mon, 27 Mar 2000 16:28:19 +0000 [thread overview]
Message-ID: <1000327162820.ZM15657@candle.brasslantern.com> (raw)
In-Reply-To: <200003271143.NAA05644@beta.informatik.hu-berlin.de>
On Mar 27, 1:43pm, Sven Wischnowsky wrote:
} Subject: Re: endianness of wordcode
}
} Bart Schaefer wrote:
}
} > In particular
} > I'm not sure how to explain what happens if you do
} >
} > zcompile -c foo foo bar frob ding
} > fpath=($PWD)
} > autoload foo
} > foo
}
} I don't understand what you mean here. If foo is already defined, the
} autoload won't change that and you just get that executed. If foo is
} unfunction'ed before the autoload, it loads foo.zwc and executes foo
} just as expected. At least for me. What am I missing?
Sorry, I got in too much of a hurry there ... in each of these examples,
the zcompile line explains how the file foo.zwc was created; the other
three lines were then executed in a fresh "zsh -f" so that _none_ of the
functions (foo bar frob ding) are defined.
The question in this first case is: `bar', `frob' and `ding' do not
become available when foo is autoloaded, but why not? If I had a text
(not .zwc) file named `foo' inside a directory in $fpath, and that
file contained four functions, and I said to autoload foo and then I
executed foo, all four functions would become defined.
If I'd said `fpath=($PWD/foo)' so that foo.zwc was treated like a
directory, I'd expect only `foo' to be searched out of it; but since
`foo' is *inside* a directory in $fpath, I expected it to be treated
like a script. (Well, *I* didn't, but I'm trying to think like a
newbie.)
} > And I'm even more confused by
} >
} > zcompile -c foo -k foo bar frob ding
} > fpath=($PWD)
} > autoload foo
} > foo
} >
} > which first executes "foo" successfully and then prints
} >
} > foo:3: foo: function not defined by file
} >
} > leaving "foo" as an undefined (but marked autoloaded) function.
}
} Here at least `foo' was already defined, right.
No, again I messed up ... the zcompile was in a separate shell.
} This is a problem I
} hadn't thought about. If we save it to be loaded ksh-style, the init
} code originally surrounding the function definition (if there was any)
} is, of course, already deleted. So, the best attempt we could do is to
} put the body of the function in a `foo() { body }' and save that [...]
} Note also, that for ksh-style autoloaded function that aren't
} loaded yet, the whole contents of the definition file is put into the
} wordcode file (i.e. one gets different results depending on whether
} the function is already loaded or not).
Given this, I think we should just make -k not work at all with -c, and
ignore kshautoload on -c as well, i.e. -c always behaves as if -z. If
-k is given, stop with an error, and if kshautoload is set, print an
informative warning message but write the file anyway.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
next prev parent reply other threads:[~2000-03-27 16:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-27 11:43 Sven Wischnowsky
2000-03-27 16:28 ` Bart Schaefer [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-03-27 8:32 Sven Wischnowsky
2000-03-23 21:04 Peter Stephenson
2000-03-25 20:39 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1000327162820.ZM15657@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).