zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>,
	"ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: Re: ${(A)=xxx} - second go - now real bug.
Date: Wed, 7 Jul 1999 17:15:40 +0000	[thread overview]
Message-ID: <990707171540.ZM2453@candle.brasslantern.com> (raw)
In-Reply-To: <002501bec88d$f467f470$21c9ca95@mow.siemens.ru>

On Jul 7,  7:32pm, Andrej Borsenkow wrote:
} Subject: ${(A)=xxx} - second go - now real bug.
}
}      [...] 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 and useful. And I have a feeling, that it was once
} so.

Read that sentence again, and note the word "converted."  It has *never*
been the case that ${(A)foo=bar baz} is the same as foo=(bar baz).

} I suggest changing it to the described. That is,
} 
} ${foo=bar} - the same as foo=bar (with blanks quoted, 'course)
} ${(A)foo=bar}, ${(AA)foo=bar} -
}              the same as foo=(bar)

I looked at this a bit when we had the last go-round about ${(A)foo=}.
The problem is that
	foo=(bar baz)
can be determined at lex time to be an array assignment by recognizing the
parens, whereas
	${(A)foo=bar baz}
lexes as a parameter expansion.  The lexer doesn't know that (A) is there,
and therefore can't break "bar baz" into words; it reads the entire ${...}
as a single string, which it is then up to the parameter expansion code to
interpret.  It has always been like this.

} A good question is, if we should do globbing in above cases. I dare to say,
} that it may be useful ...

Yes, it would, and that is in fact the reason that I looked into the issue
before.  It doesn't work for the same reason; the entire ${...} has already
been tokenized by the time it gets to the parameter code.

It *might* be possible to undo the tokenization and re-parse the string,
but that would involve invoking the lexer from the parameter code, which
I was not prepared to undertake.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      parent reply	other threads:[~1999-07-07 17:22 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
1999-07-07 15:50 ` Andrej Borsenkow
1999-07-07 17:42   ` Bart Schaefer
1999-07-07 17:15 ` Bart Schaefer [this message]

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=990707171540.ZM2453@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=Andrej.Borsenkow@mow.siemens.ru \
    --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).