Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: declare -p and -H (hideval)
- X-seq: zsh-workers 41115
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: declare -p and -H (hideval)
- Date: Wed, 17 May 2017 09:07:16 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=TfLBadWVw5m0tUxMSOxeNqyTjPmwaduZX470VuKR/rk=; b=CJkwqU/L mXOyPpN1bh7x5/5++2ovBafGB3cB9EBAwMxKnz/jJxZD9csqLS61ANAWcFmt8YyS mDVcuh0rKFMqJJbyGwur4PiJr+gdGcyCpZVKnLjtRDe+Z8Po6C1O52ubDh4ysfub nY5VbwNs1lynsu0nGjqAHrcyBWknXBBtJN11w9OWIq+oVEGr/BEwDidi9dT87LlE OCnuCzD4LvQllEg6bmv+hCatJlkEvVX30V04HkowWE/lSWHPP1cC8hbFWQwp27kQ 6tNvvbcRWLXTZvNyRVnoB8hDuNSiZ/HsbdJF49/9h2+UEM1ncOC8c90FMxGkUmNu rM3ZFESQs3Tzcw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=TfLBadWVw5m0tUxMSOxeNqyTjPmwaduZX470VuKR/rk=; b=XaEqT4HA LSbS2W7IJrAF+vrbvxNXJ0vaFh8rDw0+/b92xqgtBcvoARYxKldHvvYGOop9LcF1 MUIOk5MnQjb6uJFoTReRvZj7oHfeKfA3ypwO5glRPWXJwTFfGFkhgIQbG+zHzi0v liBTpSTrn7PYSe4VST4ypYwlVIqGjk/xQLD1FfTMKnfvSuWg2nfXbBhwT4A7tzUD xCZh3TZkdISFMmOHo4wfyA/iqybCAXmxfSdDB2hs9OstDTX361+F9Ozf3aiRo+yW kAiohBdrXR3mJYNjg8/Z4d3NHD8Y2K5nvqUfK+mWqWPWI1YrFQzpBJQ94vG5ElQA CpSg/xZzAKtNIw==
- In-reply-to: <170515130309.ZM19685@torch.brasslantern.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: <etPan.5915e115.238e1f29.6b4c@MacMini.local> <170512150302.ZM9904@torch.brasslantern.com> <20170514010444.GA4046@fujitsu.shahaf.local2> <170514102207.ZM15414@torch.brasslantern.com> <20170515133610.GA21381@fujitsu.shahaf.local2> <170515130309.ZM19685@torch.brasslantern.com>
Bart Schaefer wrote on Mon, May 15, 2017 at 13:03:09 -0700:
> On May 15, 1:36pm, Daniel Shahaf wrote:
> }
> } Bart Schaefer wrote on Sun, May 14, 2017 at 10:22:07 -0700:
> } > It'd be quite simple to make -pm behave differently
> }
> } I went down the rabbit hole, and it seems pretty sane so far:
>
> This (changing the default behavior of -p) isn't where I'd have gone
> with this. I'd have e.g. added PRINT_INCLUDEVALUE to the flags in
> the case of -m and -p used together.
The logic I aimed for was: the -p flag shouldn't affect whether the
value is printed, regardless of whether the positional arguments are
parameter names or parameter name glob patterns. I.e., make -p and -m
orthogonal.
> Even in your patch, I don't see any purpose to PRINT_ALL that isn't
> covered by _INCLUDEVALUE.
So it's correct but redundant/duplicative? Understood.
> } + { PM_EXPORTED, "exported", 'x', 0},
> } + { PM_HIDE, "hiding", 'h', 0},
> } + { PM_HIDEVAL, "hidden value", 'H', 0}
>
> I don't think it's quite that easy. For one thing PM_HIDE can be
> attached to a top-level variable, but has no effect there, so it's
> not clear whether to include it in the typeset output or if instead
> it needs special handling ala PM_EXPORTED.
I assume you're referring to this block of printparamnode()? —
.
} else if ((pmptr->binflag != PM_EXPORTED || p->level ||
(p->node.flags & (PM_LOCAL|PM_ARRAY|PM_HASHED))) &&
(p->node.flags & pmptr->binflag))
.
I think that simply makes sure that "-x" won't be printed for exported
variables, since the command name was alredy printed as "export" for
them?
In any case, I'd lean towards preserving the -h bit on top-level
variables, just on general principles of making «eval $(typeset -p)» as
idempotent as possible.
Is anything else wrong with extending pmtypes in this manner?
Thanks for the review.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author