zsh-workers
 help / color / mirror / code / Atom feed
From: Fung-Chai Lim <fclim@singnet.com.sg>
To: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: Re: Autoloading of compctl from dbm database file.
Date: Sun, 1 Dec 1996 21:22:43 +0800 (SGT)	[thread overview]
Message-ID: <9612011323.AA00468@fclim.singnet.com.sg> (raw)
In-Reply-To: <8922.199611301640@stone.dcs.warwick.ac.uk> from "Zefram" at Nov 30, 96 04:40:31 pm

In <8922.199611301640@stone.dcs.warwick.ac.uk>
on Sat, 30 Nov 1996 16:40:31 +0000 (GMT)
Zefram <zefram@dcs.warwick.ac.uk> writes:

> We already have a function autoloading facility.  Aliases are cheap to
> store, usually short, and people don't have so many of them.  I think
> it is therefore not worth adding the database autoloading for them.
> However, a dbm database may be a good solution to the problem of
> autoloading compctls.

First of all, remember my patch is only a SAMPLE IMPLEMENTATION, meant
as a sort of request for comments.

I started with just the idea of autoloading compctl.  Later on, I added
the others (not much extra work) because of the -K compctl flag.  If that
compctl is autoloaded, then its associated function should also be.

I did not extend my code to store arrays to cater for the -k compctl flag.
I shipped the patch out as it is because I wanted to know what you guys
think about autoloading from a dbm file.  Autoloading arrays and others
would be easy to code.  Anyway, global aliases can be used for arrays.

Having aliases and functions in the database can be useful.  Remember my
example, putting
	ZDBFILE=database
	zdb -auf
at the top of any shell script is enough to access aliases and functions.

> The idea of creating a single global database is flawed.  These
> databases *must* be individual.  (However, the capability to use
> several database files at once, in a path structure, to allow sharing
> of compctls would be good.  Automatic installation of a standard
> database of compctls would then be justifiable.) All we really need is
> the extra builtin to allow saving and autoloading of compctls, and it
> is then easy enough to edit the database by hand from a normal shell.

The compctl command is a complicated beast; I don't understand most of
the doc on it.  The idea behind the global database is for a compctl guru
to maintain it for the benefits of other users.

Although the user is allowed to, I don't think it is good idea for each
user to have several dbm files as it would be harder for him to maintain.
Instead, one file with multiple namespaces.  Initially, I was thinking of
subdividing each namespace to support the varieties of platforms, etc.
Consider the psg() function.  And suppose the database is to be shared
by both SysV and BSD systems.  Using only one function definition would
mean a fatter and hence slower function.  I was thinking of copying the
way the folks at X11 had incorporated locale information into their
XAPPLRESDIR, et al, for the syntax of the path to specify the search
order of the subdivisions within a namespace.  I gave up the idea of
subdivisions because it was too difficult to contemplate.

(One trick to write the psg() function is to put a redefinition inside
its definition; the redefinition is slimmer, restricted to the platform.
See my Database/cd.func)

> You limit the code to gdbm, because it does locking.  I suggest that if
> we use code like this, that we handle standard dbm as well, either
> doing locking ourselves (with more autoconfed code) or ignoring the
> issue (after all, the databases won't be changing *that* often).

I don't understand what you mean by `as well'.  Are you saying that the
shell understands various dbm packages?  Or use whatever dbm package
that comes with the system?  The latter may not be a good idea because
the database may be shared over a distributed file system by systems of
different architectures.  The database must be portable over networks.

I think one of the public domain dbm packages should be selected and
either the source code is distributed together with zsh or a pointer
is given on where the user can get hold of it.

Having said that, I think that if the 4BSD's DB package is selected
(I vote for it), then a stripped down version is bundled in, similar
to what Keith Bostic have done in nvi.  After all, not all 3 mechanisms
offered by the package are needed.

Finally, I don't know enough of the innards of a dbm file to comment
on not locking.  I agree that saving to the databases is a rare event.
However, reading them can be frequent, especially when they are shared.
I wonder if the *shell* will be corrupted when fetching data from a dbm
file at a time when the file changes size.

Regards,
fclim.


  parent reply	other threads:[~1996-12-01 13:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-30 13:31 Fung-Chai Lim
1996-11-30 16:40 ` Zefram
1996-11-30 23:16   ` Bart Schaefer
1996-12-01 12:55     ` Fung-Chai Lim
1996-12-01 14:02     ` Zefram
1996-12-01 17:41       ` Bart Schaefer
1996-12-01 18:08         ` what should compctl's look like? Richard Coleman
1996-12-01 18:54           ` Zefram
1996-12-01 18:38         ` Autoloading of compctl from dbm database file Zefram
1996-12-02 13:23         ` Fung-Chai Lim
1996-12-01 13:22   ` Fung-Chai Lim [this message]
1996-12-01 14:17     ` Zefram
1996-12-01 15:38       ` Fung-Chai Lim

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=9612011323.AA00468@fclim.singnet.com.sg \
    --to=fclim@singnet.com.sg \
    --cc=zsh-workers@math.gatech.edu \
    /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).