Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Anyone want to help make zsh/db/gdbm work?
On Thu, 29 Jan 2015 14:06:25 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> ztie() still calls createspecialhash() which only succeeds if the
> parameter is not set. So to make a ztie parameter local, one has
> to do this:
>
> (){
> local foo
> unset foo
> ztie -d db/gdbm -f gdbmdb foo
> # $foo is now a local ztie
> }
>
> Still, this makes wrong the part of the doc I wrote about it always
> creating a global parameter.
>
> Should we document the need to both declare and unset the parameter,
> or should we add an implicit unset to ztie() ?
It should probably unset the variable; any other attempt to reuse a
variable declared local (e.g. by declaring it local as a scalar and
assigning it as an array) will silently do that, so I don't see why this
should be different.
Arguably that should be down in createparam(), which isn't told the full
story of the parameter you want to create; stuff like whether it's being
declared local or not, or whether you need to change the type, is
handled up above, creating what's currently a fairly monstrous
interface with createparam() acting as a backend to a lot of half-baked
logic.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author