On 2/2/22 1:40 PM, Martijn Dekker wrote:
> Op 01-02-22 om 15:23 schreef Chet Ramey:
>> Historically, bash (and ksh93) has favored the former. Just about all the
>> other shells claiming some sort of POSIX conformance favor the latter (all
>> the ash-based shells, yash, mksh).
>>
>> What are your plans here?
> 
> I've no current plans. Any remotely plausible use of aliases is not going
> to be affected either way. I've done some pretty innovative stuff in
> modernish that involves aliases and that too would be unaffected. In my
> view, this difference is relevant to standards and regression test writers
> and probably no one else.

I agree; most current scripts will continue to run just fine.

> Having said that, I've never understood why ksh stores command
> substitutions as unparsed source code (including comments and all) in the
> parse tree and only parses that at execution time -- including in dot
> scripts (which are otherwise parsed in their entirety before execution) and
> shcomp bytecode output. That seems bizarre. It doesn't do that for regular
> subshells in parentheses or for process substitutions.

Probably because the paren commands are never parts of words and it makes
no sense to join a process substitution to another word.

But command substitutions are parts of words (granted, most of the time the
complete word) so it's simpler to retain the text, parse it again to find
the closing `)' during expansion, and perform the command substitution
than to carry around an arbitrary number of parse trees along with the
word, including where each should start and end. It's probably more
bookkeeping than Korn wanted to  do, though Ken Almquist managed it.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to