Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Named reference (and other) pending work
- X-seq: zsh-workers 54462
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- Cc: Mikael Magnusson <mikachu@xxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Named reference (and other) pending work
- Date: Sun, 3 May 2026 11:02:54 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xjVhMGBf6oSiQp4idY90CL0IlG5XHX1lXDJlTNEK7h4=; fh=fIE17+cvrF6Xu9ZzUv6X4rn8vpVsF3bLgqh8aVdQPuk=; b=TQN8GE5+GJU5eOp9KJeupMRpJhr1IDmSrsSxHCgRbdeV6Jhz1Wd6uxuOW/EwmNABcZ ekJtFwkkDT2QTayHzuxw8xzCP+P75PvTRj6O9jurrfumiEFl8x7DVGnY/luQbhggB6cN X/HzvNj3UVnjLJkmHRlvYXu059TtqWhpM1zjDIs71BCtXDp0yDWW4hhC0mX/VjGenlb8 iKiSz3GCxFQytfOTqtVXHfm4n8uB/ogJBjOu+iMlmXqh99Ie6cxJXbeHonLPt5IEmajZ isIweRWpc1+NkGXwDyWPe49udjN0qCzrt975PlcLbt6jV/xRpgEeL+ZDxIucWr0abzyF wEWw==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1777831385; cv=none; d=google.com; s=arc-20240605; b=C4G2Nxv6x1YGZC8fJ2jhhw3MKMbkQZCDAvUn3Q4XuQMGCPUE2o1TIdx05scZ1Gkx0l neSJYrHYRva/Ms51VDLF/KfdBHFnmEhrmbRjz+W2E088NPj0a2n4iaCdLQpVoJXVm4yf niPL5YrpCmg7C4iL3sB7K/Kc62mpuIUcdV1IjYmtB9BMGvBJ38En61rDLO9OZiJ0+R9n FnMPL3evd1qtD/0v3dXPcixV619q/wKum/u7JxDKpS6KXayfVfxYzUpjUs9up7qce2jw apI41XxuW3zTfqyECmSjzH9zey+LlxQ+eitAt+NV2WZmxzMkqEonIKHxUDsbvcIx6r3C PhhA==
- Archived-at: <https://zsh.org/workers/54462>
- In-reply-to: <CAGdYchsWuiqOgFwXf2y5exh=Xp6Bck5L8VSE0TJZ_1jOEx1Grg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchs+naf4xm2RcK_vfsMPCuiYPqf-050-Z6z-Ch095Y+hGw@mail.gmail.com> <CAH+w=7Zin9TNo6T-K90G1Y2ANFgB5TH=7Xn23gOpsmqchiO02w@mail.gmail.com> <CAHYJk3TCJVj5G8B4Om9G-5OyCSqRov43E7HY51PAXGANg5JiVA@mail.gmail.com> <CAGdYchsWuiqOgFwXf2y5exh=Xp6Bck5L8VSE0TJZ_1jOEx1Grg@mail.gmail.com>
On Sun, May 3, 2026 at 1:22 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>>
>> > In ksh, any attempt to dereference a placeholder reference triggers an error. Zsh should do the same.
>>
>> I disagree (except in ksh emulation mode).
>
> So should there be a check for ksh emulation mode?
Rather, I meant that I would not disagree in ksh emulation mode ...
but there are a lot of places where we're not faithful to ksh
emulation (consider any of several other expansions, or look at the
doc for the ksh93 module) so I don't think it's especially important
to follow that here either.
> One example of dubious behavior is if you try to unset (with no -n) a placeholder reference or a chain to a placeholder reference. This should unset the referred variable but since there is no such variable the current code unsets the placeholder reference. I think that in this case it would make more sense to complain
Hm, I agree that it likely shouldn't unset the reference, but I'm
undecided about the complaint -- `unset this_was_never_set` doesn't
complain. On the other hand
unset ${(!)placeholder}
would complain about not enough arguments. I could go either way.
> Similarly, if you use typeset -i var to change the type of var and it turns out that var refers to a placeholder reference, it tries to change the type of the placeholder reference (which triggers an incompatible type change error) while it would make more sense to complain that there is no referred variable.
I agree that the error could be more specific. The case where 'var'
is a nameref pointing to something that doesn't exist already creates
the referent, the same way an assignment would, with PM_DECLARED or a
default value depending on typeset_to_unset, so that's fine.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author