Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Memory leak when working with undefined associative array keys & problems with unset
- X-seq: zsh-workers 41750
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx " <zsh-workers@xxxxxxx>
- Subject: Re: Memory leak when working with undefined associative array keys & problems with unset
- Date: Sat, 23 Sep 2017 18:48:44 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=FpdCmrIPQuTxAFog2JD470n4E0Mxv3smZ416vuO0Jeg=; b=SEJOOpRBsF0G0Dy/3ceM/DYDKmV4vCUS2GPyA3FJiB3GrPHO/nLIRSyVQ9twVlglU2 jK1XvydGk1EKi86tjwqC1A1UOPWc7pRH3rWqrIda+inBpgXot5zvga/Z9lyYpuRXF/gG BI3XV/GKHVHmKvW0TLMTe2KAVdK7AvDJUgekFrQByF36D2mjb9vNg7MZKzH8/emT+7kG HmoRC7XfZknU1F59C9JfsR36CfHGh0fFDFpXfLnjHxvu+YkM5QXWEtO9j0t2XSQKPUWY 15xDaS0hRdq0WmimcNeAmPQkljv2MEv+FSqpxcuq3eWWlgchjrZQx1HqUgcBUKff1eXn 8jYw==
- In-reply-to: <20170923185958.7bddbd39@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <VI1PR0501MB23514D1D7839FDF243840C91D76D0@VI1PR0501MB2351.eurprd05.prod.outlook.com> <170917161514.ZM21068@torch.brasslantern.com> <20170923185958.7bddbd39@ntlworld.com>
On Sep 23, 6:59pm, Peter Stephenson wrote:
}
} Can we really not do something like the patch below?
The point of my later "naughty bit" remark was that we'd have to do
something exactly like that patch, so, yeah.
} > } $ unset "a[$key]"
} > } unset: a[hello * [ world]: invalid parameter name
} >
} > Hmm, when examining ${a[$key]} we enter parse_subscript() with $key
} > tokenized, but there's no way to get the tokenized string to reach
} > the same point in the unset builtin
}
} I gave up on this ages ago, frankly. We certainly a need way of raw key
} reference, but I don't think we've got one, and each time we tweak it we
} seem to make it even more tortuous.
The basic problem is that a[$key]=foo is parsed in assignment context,
but unset a[$key] is parsed in ordinary word context. I don't see any
way around this other than either making unset a keyword, or adding a
command-line option to unset as Daniel suggested. Neither of these
alternatives makes me very happy.
As noted, ksh93 has (had?) also thrown up its hands on this one.
} Possibly we need yet another flag
} to say "FOR ****'S SAKE DON'T TRY TO BE CLEVER NO I MEAN IT ****" (but
} without the Tarantino script edit).
I can't think of anywhere to attach such a flag.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author