From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: why is eval needed?
Date: Sat, 19 Nov 2022 14:21:32 -0800 [thread overview]
Message-ID: <da8b2618-3c6f-8825-02ca-b8dfba9abc6b@eastlink.ca> (raw)
In-Reply-To: <3fa3f7ff-1733-4730-a62f-dd0e138c3b72@app.fastmail.com>
On 2022-11-19 11:50, Lawrence Velázquez wrote:
>
> A "single argument" is not intuitive at all. You would not run
>
> tree '-L 2'
>
> or
>
> tree -L\ 2
>
> so it does not make any sense to think that "tree" wants a single
> argument there.
Intuition is subjective. Besides, usually such switches don't demand a
space IIRC and it really is actually one argument, this is an exception.
Even if the space is demanded, one might still think of a switch as a
single semantic instruction even if it must be syntactically two words.
A filename with a space in it is NOT broken in half, it's still one
entity, so I'm thinking the same way. I myself was naively thinking of
it as nothing more than a string of four characters to be dropped into
another string of characters -- as simple as that. As if it was the
command line. But commands do have their need to group characters into
arguments so the invisible rules must be followed. ' -L 2 ' must be
invisibly broken in half. Which, interestingly 'eval' seems to do
automatically. It's a huge thing coming to understand that what to me
might look like 'just' a string of characters, to a command, needs to be
viewed differently. Once I understand that, things get much simpler. I
guess internally zsh must have all sorts of meta data attached to arrays
to keep track of what's joined/split to/from what else. It would be
cool to be able to somehow see this invisible stuff, some way to see the
invisible structure of a command line. But I'll be ready the next time
something like this crops up.
next prev parent reply other threads:[~2022-11-19 22:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-19 14:34 Ray Andrews
2022-11-19 14:43 ` Roman Perepelitsa
2022-11-19 17:02 ` Ray Andrews
2022-11-19 17:10 ` Roman Perepelitsa
2022-11-19 18:02 ` Clinton Bunch
2022-11-19 18:18 ` Roman Perepelitsa
2022-11-19 16:48 ` Stephane Chazelas
2022-11-19 19:12 ` Ray Andrews
2022-11-19 19:50 ` Lawrence Velázquez
2022-11-19 22:21 ` Ray Andrews [this message]
2022-11-20 8:55 ` Stephane Chazelas
2022-11-20 13:47 ` Ray Andrews
2022-11-20 15:08 ` Stephane Chazelas
2022-11-20 16:27 ` Ray Andrews
2022-11-20 20:16 ` Stephane Chazelas
2022-11-20 22:31 ` Bart Schaefer
2022-11-21 2:13 ` Ray Andrews
2022-11-20 22:47 ` Ray Andrews
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=da8b2618-3c6f-8825-02ca-b8dfba9abc6b@eastlink.ca \
--to=rayandrews@eastlink.ca \
--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).