Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Aliasing separators (Re: grammar triviality with '&&')
- X-seq: zsh-workers 34660
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Aliasing separators (Re: grammar triviality with '&&')
- Date: Thu, 05 Mar 2015 17:40:11 +0000
- In-reply-to: <150305090720.ZM8441@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <54F33934.2070607@eastlink.ca> <13666281425228233@web7o.yandex.ru> <54F345D3.9010204@eastlink.ca> <D0509295-7DA9-4F18-9E3D-D50C0A756998@larryv.me> <20150302022754.GA7449@xvii.vinc17.org> <CABx2=D8efL3X2tfB+_+VweY2yye6EhaMNbJa3b3jJeVMp=7gaQ@mail.gmail.com> <20150302104619.GC6869@xvii.vinc17.org> <20150302110610.2e2c7e86@pwslap01u.europe.root.pri> <CAH+w=7YoHjN85hqOZVywOfYGZqvU74vZrbE84Ln+V2HQi-6nSA@mail.gmail.com> <20150304144756.GA27231@ypig.lip.ens-lyon.fr> <150304175112.ZM19818@torch.brasslantern.com> <20150305100638.55631238@pwslap01u.europe.root.pri> <150305090720.ZM8441@torch.brasslantern.com>
On Thu, 5 Mar 2015 09:07:20 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Consider, with this patch in place:
>
> torch% alias -g '&&'=foo
> torch% set -x
> torch% true&&false
> +Src/zsh:3> true foofalse
> torch% &&bar
> +Src/zsh:4> foobar
> zsh: command not found: foobar
>
> That's CERTAINLY not the intended behavior
I would tend to agree with that, but that's largely because I have no
idea what the intended behaviour would be. It doesn't surprise me you
can get gobbledygook if you alias tokens to something with a different
behaviour. You get gobbledygook of a different kind if you alias
reserved words to something with a different behaviour. ('alias -g' has
always been a disaster waiting to happen, but I think the basic feature
is there without that.)
> Aliasing only of STRING tokens is exactly the right thing and this change
> is simply wrong. The doc only says "before parsing" as a shorthand instead
> of a long explaination about how the alias is replaced and then parsed all
> over again.
If you can produce an alternative patch describing the previous position
properly, go ahead. I don't think anyone is actually screaming to use
this change.
Personally, I don't see why allowing someone to alias \& but not &&
is logical; either you give users enough rope to hang themselves (and we
do), or you limit it to non-metacharacters (and we don't).
alias -g '*=*; print nonexistent-file'
ls *
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author