zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Oliver Kiddle <opk@zsh.org>
Cc: Zsh workers <zsh-workers@zsh.org>
Subject: Re: namespaces limitation
Date: Thu, 25 May 2023 15:09:31 -0700	[thread overview]
Message-ID: <CAH+w=7YBoMrNOokZmDJJehv2oF_RUkhY=USmJFHb-A8X32LaLA@mail.gmail.com> (raw)
In-Reply-To: <92928-1684946470.047218@Qy70.4SHd.nnDI>

On Wed, May 24, 2023 at 9:41 AM Oliver Kiddle <opk@zsh.org> wrote:
>
> One option might be to disallow bare namespaces, so
>
>   integer .var=56
>
> would be disallowed.

I had it that way at one point and backed off because ksh allows it.

> Where .3 just looks really wrong, .3.var feels
> innocuous.

Strictly speaking (to the extent that any of this is strict),
namespaces are supposed to otherwise obey the rules for identifiers,
which with the exception of positional parameters are not allowed to
begin with a digit ... so I think I'll just go with that.

I still haven't worked out how to deal correctly with .var.3x -- ksh
allows .var.3 but rejects .var.3x so although it's a simple !idigit()
test to disallow anything starting with a digit, it's more work to
allow numbers but not strings that begin with a number.  Currently
that's handled in isident() at a point which precedes the check for
presence of a namespace.  Hrm.

> Also questionable is the following which currently works:
>
>   .a.=ddd
>
> The ksh error for this is 'no parent'

That probably should be rejected, yeah.

> We also currently allow a.=ddd but I think that is less
> questionable. We allow empty association elements.

I'm still not entirely sold on the x.y <=> x[y] mapping idea, but if
we follow JavaScript's (somewhat questionable) lead on this, empty
elements have to use bracket-notation rather than dot-notation.


  reply	other threads:[~2023-05-25 22:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  0:13 Oliver Kiddle
2023-05-23 17:10 ` Bart Schaefer
2023-05-24 16:41   ` Oliver Kiddle
2023-05-25 22:09     ` Bart Schaefer [this message]
2023-05-25 23:13       ` Bart Schaefer
2023-06-22 17:49       ` [PATCH] " Bart Schaefer

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='CAH+w=7YBoMrNOokZmDJJehv2oF_RUkhY=USmJFHb-A8X32LaLA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=opk@zsh.org \
    --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).