zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: Re: ${(A)=xxx} - second go - now real bug.
Date: Wed, 07 Jul 1999 17:43:00 +0200	[thread overview]
Message-ID: <9907071543.AA37134@ibmth.df.unipi.it> (raw)
In-Reply-To: ""Andrej Borsenkow""'s message of "Wed, 07 Jul 1999 19:32:42 DFT." <002501bec88d$f467f470$21c9ca95@mow.siemens.ru>

"Andrej Borsenkow" wrote:
> Reading docs once more I noted this:
> 
> A
>      Create an array parameter with ${...=...}, ${...:=...} or
>      ${...::=...}.  If this flag is repeated (as in AA), create an
>      associative array parameter.  Assignment is made before sorting or
>      padding.  The NAME part may be a subscripted range for ordinary
>      arrays; the WORD part *must* be converted to an array, for example
>      by using ${(AA)=...} to activate word splitting, when creating an
>      associative array.
> 
> Please, note the last sentence. It implies, that in case of array/hash
> assignment the word is treated as in array assignment - that is, ${(A)foo=bar
> baz} is basically the same as foo=(bar baz). At least, I find this natural an
> d
> useful. And I have a feeling, that it was once so.

I think you've missed the sense of the = after the (AA) in that
substitution, which is to turn on word-splitting: ${(AA)=foo::=a b}.  As
far as I know it's always been like that.  (=, ~, ^ would have been flags
if they'd been invented later, it's rather a mess to say the least.)

But I don't really like this way of doing things anyway, since it's getting
round lexing and parsing in slightly odd ways.  It would be nice to be able
to do this properly, though.  We really need a syntactically sensible way
of generating expansions arbitrarily deeply inside other expressions
without forking.  The suggestion for doing globbing here in ordinary cases
doesn't fit in with the shell expansion order, which is that globbing is
only performed on the final result of parameter expansion (assuming
globsubst, of course).

The error message has got too many newlines, which is annoying me.

--- Src/params.c~	Tue Jul  6 13:31:11 1999
+++ Src/params.c	Wed Jul  7 17:29:26 1999
@@ -1905,7 +1905,7 @@
 
     if (alen % 2) {
 	freearray(val);
-	zerr("bad set of key/value pairs for associative array\n",
+	zerr("bad set of key/value pairs for associative array",
 	     NULL, 0);
 	return;
     }

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


  reply	other threads:[~1999-07-07 16:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-07 15:32 Andrej Borsenkow
1999-07-07 15:43 ` Peter Stephenson [this message]
1999-07-07 15:50 ` Andrej Borsenkow
1999-07-07 17:42   ` Bart Schaefer
1999-07-07 17:15 ` 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=9907071543.AA37134@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).