zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-workers@zsh.org
Subject: Re: 4.3.17 unset RPS1 vs RPROMPT
Date: Fri, 29 Jun 2012 22:05:12 -0700	[thread overview]
Message-ID: <20120630050512.GA87092@redoubt.spodhuis.org> (raw)
In-Reply-To: <20120629195254.5dba2156@pws-pc.ntlworld.com>

On 2012-06-29 at 19:52 +0100, Peter Stephenson wrote:
> I'm still not really following what you're trying to do, but my guess is
> you're not actually trying to unset the variable at all, you're trying
> to set it to an empty string.  They may sound similar, and they often
> have the same effect, but they are different things.  If the variable is
> unset, it is indeed uncoupled from anything else that's going on, which
> is kind of what unset means.  So unsetting an unset variable does indeed
> have no effect.

I'd decided it was a bug because that's what unset means, but setting it
again rebinds it to have the same meaning as before, so it can't be
meaningfully unset.  You can't rebind the variable name to a different
internal structure, so at this point the semantics become somewhat
messed up.

I think that there's a bug here, but deciding what the correct behaviour
should be is non-trivial and certainly not worth blocking 5.0.0 for.

Fundamentally, in zsh at present, it seems that magic variables can not
have their magic purged from them as the names can never truly be
unbound, just temporarily made unavailable, yet the same content can be
available under other names.  For library-level robustness against
someone having set a prompt variable (PROMPT3/PS3 for instance) but
unbound one of the names, getting back consistent state seems to require
setting both names and only caring about the value of which one is set
second, so that both names remain available thereafter.

If the name could be rebound to another variable and no longer be magic,
the current approach would be sane, but it seems that perhaps the
correct behaviour should be to ensure that whatever the state of one
name, the other name should be in the same state: set, unset, empty,
with-content, whatever.

Perhaps I've become contaminated with the Pythonic approach of being
distinct about the binding of a name to a variable versus the changing
of the value of a variable.

-Phil


  reply	other threads:[~2012-06-30  5:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29  9:40 Phil Pennock
2012-06-29 10:02 ` Mikael Magnusson
2012-06-29 13:32   ` Phil Pennock
2012-06-29 17:35 ` Bart Schaefer
2012-06-29 18:52 ` Peter Stephenson
2012-06-30  5:05   ` Phil Pennock [this message]
2012-06-30 17:31     ` Bart Schaefer
2012-07-01 17:39     ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
2007-05-03  5:39 [PATCH] Proposal: stat -> zstat Phil Pennock
2007-05-03  8:50 ` Peter Stephenson
2007-05-06  1:07   ` Phil Pennock
2007-05-06 11:57     ` Peter Stephenson
2007-05-06 14:00       ` Phil Pennock
2007-05-07  0:58         ` Peter Stephenson
2007-05-03 14:48 ` Bart Schaefer
2007-05-03 15:46   ` Peter Stephenson
2007-05-07  5:31     ` Bart Schaefer
2007-05-08 14:40       ` Peter Stephenson
2007-05-09 17:19         ` Bart Schaefer
2007-05-09 17:47           ` Peter Stephenson

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=20120630050512.GA87092@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=p.w.stephenson@ntlworld.com \
    --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).