From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: declare -p and -H (hideval)
Date: Wed, 17 May 2017 09:07:16 +0000 [thread overview]
Message-ID: <20170517090716.GA4614@fujitsu.shahaf.local2> (raw)
In-Reply-To: <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
parent reply other threads:[~2017-05-17 9:16 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <170515130309.ZM19685@torch.brasslantern.com>]
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=20170517090716.GA4614@fujitsu.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--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).