zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: dana <dana@dana.is>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Inconsistencies in "-quoting and @-splitting, could someone elaborate?
Date: Sun, 28 Oct 2018 12:54:15 +0100	[thread overview]
Message-ID: <CAKc7PVAReJOH_T24hZ3qEMpyZGaXat3Ak7muYg9vJEC6HZKhag@mail.gmail.com> (raw)
In-Reply-To: <1BE52C46-161F-412B-A539-4B0EA87A2FCE@dana.is>

On Sun, 28 Oct 2018 at 02:34, dana <dana@dana.is> wrote:

> >accidentally-similar, with possible further differences, exceptions,
> >so I would state there's a major inconsistency/historically-driven
> >problem in Zsh. Are there other such flags in Zsh?
>
> I don't understand where the inconsistency is...? Are you just speculating that
> there might be one?

@ is refered to as "@  -- double-quoted splitting of scalars" in
completion. I understand it as: for quoted expression, regenerate
array-form by doing splitting. So "$array" is a single string
containing the whole array contents (if not ksharrays, where it would
have only 1st element), while "${(@)array}" is still an array, because
theoretically, like the completion says, the "-induced string is split
to again become an array.

So one can obtain always-array behavior with @. This flag doesn't help
(s::) and (z) when the result is string. I feel this is inconsistent,
I should be able to "split" the resulting string into an array, like
it would happen here with @ and array:

% array=( "foo" )
% print "${#${(@)array}}"
1

Despite array is single element, @ splits it into array type. (s::)
and (z) behave differently for single-element result, that is one
(maybe subjective) inconsistency, and for the second – @ doesn't help
(ie. (z@) still doesn't return as an array), that's second
inconsistency IMO.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

  parent reply	other threads:[~2018-10-28 11:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27 10:33 Sebastian Gniazdowski
2018-10-28  0:34 ` dana
2018-10-28  4:54   ` Bart Schaefer
2018-10-28 11:54   ` Sebastian Gniazdowski [this message]
2018-10-28 15:41     ` Sebastian Gniazdowski
2018-10-28 15:45       ` Sebastian Gniazdowski
2018-10-28 21:20       ` Bart Schaefer
2018-10-28 21:12     ` Bart Schaefer
2018-10-29  9:10       ` Sebastian Gniazdowski
2018-10-29 15:24         ` Bart Schaefer
2018-11-05 19:03           ` Sebastian Gniazdowski
2018-11-05 23:20             ` 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=CAKc7PVAReJOH_T24hZ3qEMpyZGaXat3Ak7muYg9vJEC6HZKhag@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=dana@dana.is \
    --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).