zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: Gdbm module
Date: Tue, 21 Feb 2017 09:25:06 -0800	[thread overview]
Message-ID: <170221092506.ZM14329@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVAz=zfrFapifcJudnMqgscNudC5S4S6ym7AWfFFORoROQ@mail.gmail.com>

On Feb 21, 12:21pm, Sebastian Gniazdowski wrote:
}
} Do you think commiting "zgdbmclear" I've sent doesn't have sense?

I would prefer a bit more thought be put into the design.  There's no
particular problem with the implementation underneath, but:

The whole point of "ztie -d ..." and having the modules named with the
/db/ piece in the middle is so that a generic interface to multiple
database backends can be implemented.  "ztie" and "zuntie" happen to
be in db_gdbm.c for now because there is no other such module, but
the intention was that there would be a base "zsh/db" module of which
zsh/db/gdbm was one implementation.

In keeping with that, there shouldn't be commands named "zgdbm..." and
there should be no "zgdbm_tied" parameter -- there should instead be a
single array or hash in the (so far nonexistent) base module to return
all the ztie'd names, and if there are other ops needed than z(un)tie
then something like "zdb path ...", "zdb clear ...", etc. to give a
consistent front to whatever backend has been passed to "ztie -d".
(Or option names/letters instead of subcommands, to be more consistent
with most builtins, but you get the idea.)

This may mean that there are some ops that either we don't provide for
any backend because they're too specific to one, or that fail for some
backends.  E.g. "zdb path" doesn't make sense for a network-connected
database; maybe it returns a URL in that case, or we should consider
that the -f FILENAME argument of ztie is not sufficiently general, and
"zdb path" would just return back that argument of ztie.

None of this means we need to rush off to implement zsh/db/sqlite or
something, but we should be thinking about it when extending db/gdbm.


       reply	other threads:[~2017-02-21 17:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKc7PVAz=zfrFapifcJudnMqgscNudC5S4S6ym7AWfFFORoROQ@mail.gmail.com>
2017-02-21 17:25 ` Bart Schaefer [this message]
2017-02-21 19:52   ` Sebastian Gniazdowski
2017-02-22  4:41     ` Bart Schaefer
2017-02-22  9:10       ` Sebastian Gniazdowski
2017-02-22 15:44         ` Bart Schaefer
2017-02-23  8:19           ` Sebastian Gniazdowski

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=170221092506.ZM14329@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).