zsh-workers
 help / color / mirror / code / Atom feed
* Re: Compinstall, zcompile, and my .zshrc
@ 2000-04-10  8:37 Sven Wischnowsky
  2000-04-10  8:54 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-10  8:37 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
> 
> Second, it'd be nice if I could do something like
> 
> 	zcompile .zshrc.zwc .zshrc .zsh/*
> 
> but I'm 100% certain that's not going to produce the result I want.  For
> one thing, `. .zsh/foo' executed from the code in .zshrc.zwc is going to
> look for .zsh/foo{,.zwc}, not discover that .zsh/foo is already compiled
> into the current file.  For another, I don't know how the `.' command
> decides that xxx.zwc is the compiled form of xxx, but I wouldn't expect
> it to use a multi-file archive that way.  (Hmm, trying it, though, seems
> to show that it *will* use a multi-file archive, but that only works for
> the very first file in such an archive.)

As for loading functions from a zwc files it checks if the (basename
of the) name of the sourced file is in the zwc file. And the loads it.
In other words, you can use symbolic links:

  zcompile .zshrc.zwc .zshrc .zsh/*
  for i in .zsh/*; do ln -s .zshrc.zwc ${i}.zwc; done

> ...
> 
> There's one other thing I've just started worrying about with zcompile.
> Normally in my .zshrc I could do something like this:
> 
>     [[ $ZSH_VERSION > 3.1.6 ]] && alias typeset='typeset -g'
> 
> and now all later uses of typeset would get the -g option, because the
> code for .zshrc is actually executing as it's read.  But if I zcompile
> my .zshrc, the wordcode for the rest of the file beyond that point does
> NOT have that alias expanded.  That's a serious drawback for compilation
> of scripts, and particularly of .z* init files; it should probably be
> called out explicitly in the docs.

Yes, together with the other things that affect lexing/parsing, like
RC_QUOTES and friends.

Bye
 Sven


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


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

* Re: Compinstall, zcompile, and my .zshrc
  2000-04-10  8:37 Compinstall, zcompile, and my .zshrc Sven Wischnowsky
@ 2000-04-10  8:54 ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-04-10  8:54 UTC (permalink / raw)
  To: zsh-workers

On Apr 10, 10:37am, Sven Wischnowsky wrote:
} 
} Bart Schaefer wrote:
} 
} > Second, it'd be nice if I could do something like
} > 
} > 	zcompile .zshrc.zwc .zshrc .zsh/*
} 
} As for loading functions from a zwc files it checks if the (basename
} of the) name of the sourced file is in the zwc file. And the loads it.
} In other words, you can use symbolic links:
} 
}   zcompile .zshrc.zwc .zshrc .zsh/*
}   for i in .zsh/*; do ln -s .zshrc.zwc ${i}.zwc; done

But how clever is that?  I mean, the file's still going to be read and/or
mapped multiple times; is it really any better than compiling them all as
separate .zwc files?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: Compinstall, zcompile, and my .zshrc
@ 2000-04-10  9:05 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-10  9:05 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Apr 10, 10:37am, Sven Wischnowsky wrote:
> } 
> } Bart Schaefer wrote:
> } 
> } > Second, it'd be nice if I could do something like
> } > 
> } > 	zcompile .zshrc.zwc .zshrc .zsh/*
> } 
> } As for loading functions from a zwc files it checks if the (basename
> } of the) name of the sourced file is in the zwc file. And the loads it.
> } In other words, you can use symbolic links:
> } 
> }   zcompile .zshrc.zwc .zshrc .zsh/*
> }   for i in .zsh/*; do ln -s .zshrc.zwc ${i}.zwc; done
> 
> But how clever is that?  I mean, the file's still going to be read and/or
> mapped multiple times; is it really any better than compiling them all as
> separate .zwc files?

No, currently not. Hm, we could make the functions that looks if a zwc 
file is already mapped check if the file is the same as one of the
files already mapped usin stat, not only comparing filenames.

When they are read using one digest file doesn't have any advantages,
though.


Bye
 Sven


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


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

* Compinstall, zcompile, and my .zshrc
@ 2000-04-10  3:48 Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-04-10  3:48 UTC (permalink / raw)
  To: zsh-workers

I've presently got my .zshrc chopped up into about a dozen smaller files
all of which are read in turn from the "real" .zshrc via the `.' builtin.
Partly this is to have localized files for setting cdpath and the like in
different places where I use zsh (work, home, sourceforge (though I have
yet to actually copy it there), etc.); partly its to organize all the
cruft that's been creeping into my .zshrc in random places over the last
ten years and leave out the stuff I don't need anymore.  Those dozen files
are all in ~/.zsh/.

Now, as I sit here contemplating putting all this back together, two things
come to mind:

First, I'd like to run compinstall, but I'd like to have it put its output
somewhere other than .zshrc or .compinstall.  For that matter, I'd like to
tell it to get its *input* from somewhere other than .zshrc.  And shouldn't
it read an existing .compinstall file if there is one, either in preference
to or as well as .zshrc?

Second, it'd be nice if I could do something like

	zcompile .zshrc.zwc .zshrc .zsh/*

but I'm 100% certain that's not going to produce the result I want.  For
one thing, `. .zsh/foo' executed from the code in .zshrc.zwc is going to
look for .zsh/foo{,.zwc}, not discover that .zsh/foo is already compiled
into the current file.  For another, I don't know how the `.' command
decides that xxx.zwc is the compiled form of xxx, but I wouldn't expect
it to use a multi-file archive that way.  (Hmm, trying it, though, seems
to show that it *will* use a multi-file archive, but that only works for
the very first file in such an archive.)

I could almost make this work by putting .zshrc.zwc in $fpath and making
all the other files be autoloaded functions, but function semantics are
not quite the same as `.' -- for example, I can't use `typeset -g' if I
want any of these files to be usable by older versions of zsh, but -g is
necessary to set parameters (e.g. `typeset -U cdpath') within a function.

There's one other thing I've just started worrying about with zcompile.
Normally in my .zshrc I could do something like this:

    [[ $ZSH_VERSION > 3.1.6 ]] && alias typeset='typeset -g'

and now all later uses of typeset would get the -g option, because the
code for .zshrc is actually executing as it's read.  But if I zcompile
my .zshrc, the wordcode for the rest of the file beyond that point does
NOT have that alias expanded.  That's a serious drawback for compilation
of scripts, and particularly of .z* init files; it should probably be
called out explicitly in the docs.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~2000-04-10  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-10  8:37 Compinstall, zcompile, and my .zshrc Sven Wischnowsky
2000-04-10  8:54 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-04-10  9:05 Sven Wischnowsky
2000-04-10  3:48 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).