zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: Re: db module
Date: Mon, 30 Sep 2002 15:39:52 +0100	[thread overview]
Message-ID: <E17w1iC-00012d-00@bimbo.logica.co.uk> (raw)

On Thu, 12 Sep 2002, Clint wrote:

> This allows one to "tie" a Berkeley DB to an associative array (or is
> that the other way around?)
> 
> I'm using two hacks.  The 'extradata' field in struct hashtable holds the
> db handle for that assoc array.  Unfortunately, this doesn't seem to be
> available from the set and unset functions for the individual elements,
> so I had to use a static variable.  That means that the last DB to be
> opened is the only one that be modified.  How can this be handled
> sanely?

Instead of using pm->u.str to store a string value, I think you could
use the u.data field to point to that db handle and then use your own
function instead of strgetfn().

However, this is the sort of thing I'm trying to address with the
replacement parameter code. I dug it out and made some progress over
the weekend.

> Other notes:
> 
> This adds yet another library to be linked against all the modules.

How hard would it be to modify 16845 as suggested in 16878 so that we
at least have a short term solution.

> Examples:
> 
> zdb_open -c things /tmp/newdb.db

I would use -A instead because it is what we tend to use for
associations and we might plausibly tie a database to other types in
the future.

It's a nice idea. Could be an interesting way to do completion caching.
Thinking of it from the perspective of cached variables, it is actually
quite similar to mapfile. The mapfile module could easily have been
implemented with a builtin. e.g:

zmapfile -c file /tmp/file

where $file would then be a scalar. And this might go on further with
other similar modules. This makes me think that perhaps we could add a
hook to typeset so all these things can be declared something like this:

e.g:
typeset -A things -S db -f /tmp/newdb
typeset string -S mapfile -f /tmp/file

Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


             reply	other threads:[~2002-09-30 15:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-30 14:39 Oliver Kiddle [this message]
2002-10-02  7:37 ` Clint Adams
2002-10-06  5:32 ` Clint Adams
2002-10-06 12:24   ` Hans Dieter Pearcey
2002-10-06 16:46     ` Bart Schaefer
2002-10-06 17:03       ` Clint Adams
2002-10-06 17:14         ` Bart Schaefer
2002-10-06 17:31           ` Clint Adams
2002-10-06 20:19             ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2002-10-07 13:58 Oliver Kiddle
2002-09-12  5:19 Clint Adams

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=E17w1iC-00012d-00@bimbo.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@sunsite.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).