zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: endianness of wordcode
Date: Mon, 27 Mar 2000 13:43:49 +0200 (MET DST)	[thread overview]
Message-ID: <200003271143.NAA05644@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Sat, 25 Mar 2000 20:39:22 +0000


Bart Schaefer wrote:

> ...
> 
> } I think the zcompile documentation, and maybe other places where wordcode
> } is mentioned, could be friendlier [...]
> 
> Yes.

Thanks, Bart.

> We'd also discussed changing -r/-m to -R/-M and changing -M to -m, but this
> patch doesn't do that yet.

I haven't done that yet either, because I fear I have to do some more
with this yet.

> Sven, please check the accuracy of my edits to func.yo. 

They are correct. At least that's how it should work and seems to work 
for me.

Now...

> 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?

> 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. 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 (I
mean, zcompile would do that, the definition of foo in the current
shell wouldn't be changed).

But this is a bit ugly, too. Maybe the user just wasn't aware of this
effect and would have preferred a warning. So maybe we should just do
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).

Or maybe we should first try to find the original file defining the
function, if we find one, write that into the wordcode file (but if
foo had been changed in the meanwhile, the changes would be lost, hm), 
if not, do the `foo() { body }' trick.

Hrm. Dunno. I seem to prefer the solution that just prints an error
message and doesn't even try to create the wordcode file in such a
case.

Help, please.

Bye
 Sven


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


             reply	other threads:[~2000-03-27 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-27 11:43 Sven Wischnowsky [this message]
2000-03-27 16:28 ` Bart Schaefer
  -- 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=200003271143.NAA05644@beta.informatik.hu-berlin.de \
    --to=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).