zsh-users
 help / color / mirror / code / Atom feed
From: Clint Priest <cpriest@zsh-users.rxv.me>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Understanding why...
Date: Mon, 7 Aug 2017 20:26:12 -0500	[thread overview]
Message-ID: <d90abb51-c3f5-8385-8259-07bff97db2e6@zsh-users.rxv.me> (raw)
In-Reply-To: <CAH+w=7YoRg7whrUAdCwMsbiUPFJnJMT5nvq_SdOO7BZd7ocdCg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]

Interesting, when you say by default, is that an option that can be changed?

Thanks for that tidbit, any chance you know in the manual whereabouts it 
talks about this inner splitting and outer preservation?

Also (and I had tried to do this), is it possible to break out the 
nested expansions into their separate parts to see what is going on (via 
trace)?

I had tried that but it seemed that some zsh specific lines weren't 
showing (could have been because some of them where just variable sets, 
sans a typeset).

Thanks Much!

On 8/7/2017 7:36 PM, Bart Schaefer wrote:
> On Mon, Aug 7, 2017 at 4:46 PM, Clint Priest <cpriest@zsh-users.rxv.me> wrote:
>> I'll take an answer from someone here, but what I'd really like to find out
>> is if there is *some sort of 'set -x' functionality that would give me
>> verbose information *about what is going on.
> No, there's no trace setting that would reveal the inner workings of
> parameter expansion.  Your best bet is to look at the documentation,
> e.g., search for the string "Rules" in "man zshexpn".
>
>> typeset-A LSC=(${(@s/=/)${(@s/:/)${LS_COLORS%:}}})
>>
>> What it needed was the two @ flags.  I'd like to understand just what is
>> going on in each step of the expansion that required those two flags.
> The short answer is that a nested expansion by default joins arrays on
> the first character of $IFS and yields a scalar result.  The @ is
> necessary to indicate that you want array-ness to be preserved.  It's
> actually the OUTER ${...} that enforces joining on the INNER
> expression, so in the above you only need the leftmost @ so that s/:/
> isn't re-joined before s/=/ applies; but the second @ doesn't hurt.

-- 

-Clint


  reply	other threads:[~2017-08-08  1:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 23:46 Clint Priest
2017-08-08  0:36 ` Bart Schaefer
2017-08-08  1:26   ` Clint Priest [this message]
2017-08-08  5:25     ` 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=d90abb51-c3f5-8385-8259-07bff97db2e6@zsh-users.rxv.me \
    --to=cpriest@zsh-users.rxv.me \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@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).