Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Word breaks around aliased tokens (was Re: PATCH: Removing aliases from history, 2015 style (was capturing output of !! not working))

Bart Schaefer wrote on Wed, Mar 25, 2015 at 20:43:05 -0700:
> On Mar 25, 12:40pm, Bart Schaefer wrote:
> } 
> } torch% echo foo&&bar
> } foo foobar
> } 
> } If this were going to change, I would recommend using something akin to
> } my patch from workers/34738 to add the second space, rather than attempt
> } to remove the first one.
> That would be as below, which is almost identical to 34738 (the salient
> difference being use of INP_ALIAS instead of INP_CONT).
> I think this makes sense[*]:
> torch% alias -g '&&'=AND 
> torch% echo foo&&bar    
> foo AND bar
> (the pre-patch output is "foo ANDbar") but I will wait for feedback before
> pushing.

Agreed: "foo AND bar" makes more sense than either "foo ANDbar" or
"fooAND bar".

I'm not sure whether the following option is defensible:

% echo foo&&bar
% echo foo && bar
foo AND bar

> [*] To the extent I think aliasing these tokens makes sense at all.

I'm not sure it's a good idea either.  The only use-case I recall seeing
is the one of using '% && baz' interactively, and I don't find it
compelling, since there are numerous other ways to approach that problem
without controversial C code changes.

After all, no other language allows changing the syntax at runtime.¹



¹ Well, TeX does, but I'm not aware of anyone using it this way.

Messages sorted by: Reverse Date, Date, Thread, Author