zsh-workers
 help / color / mirror / code / Atom feed
* foo(:...) and foo~ glob
@ 1998-05-02 20:27 Zoltan Hidvegi
  1998-05-02 22:27 ` Bart Schaefer
  1998-05-05  8:48 ` Andrew Main
  0 siblings, 2 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1998-05-02 20:27 UTC (permalink / raw)
  To: Zsh hacking and development

After this change:

Sun Apr  5 20:00:40 1998  Andrew Main  <zefram@fysh.org>

          + parens always trigger globbing
          + with EXTENDED_GLOB, embedded `~' triggers globbing,
            as the documentation already states

the (:quals) syntax no longer works.  The idea was that foo(:...) should
not do globbing if there are no wildcard, but it should execute the
modifiers.  This is very useful for general text manipulation.  Of course
${${:-foo}:...} still works, but it's quite ugly.

The other change related to ~ with EXTENDED_GLOB.  Before ~ was only
treated as exclusion character if it was not at the end of the word and
the word contained other glob characters.  This allowed you to write

ls *~
rm foo~
dd if=~/foo of=bar

etc.  None of these work anymore.  I know there was a special case for
the (:...) stuff before in haswilds which was not very complicated.  I
know that someone else has also complained, so it's not only me.

Zoli


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: foo(:...) and foo~ glob
  1998-05-02 20:27 foo(:...) and foo~ glob Zoltan Hidvegi
@ 1998-05-02 22:27 ` Bart Schaefer
  1998-05-03  3:22   ` Zoltan Hidvegi
  1998-05-05  8:53   ` Andrew Main
  1998-05-05  8:48 ` Andrew Main
  1 sibling, 2 replies; 5+ messages in thread
From: Bart Schaefer @ 1998-05-02 22:27 UTC (permalink / raw)
  To: Zsh hacking and development

On May 2,  3:27pm, Zoltan Hidvegi wrote:
} Subject: foo(:...) and foo~ glob
}
} After this change:
} 
} Sun Apr  5 20:00:40 1998  Andrew Main  <zefram@fysh.org>
} 
} the (:quals) syntax no longer works.

Does this also mean that either/both of the following are broken?

	echo ${pref}**/CVS(:h) | sed 's/CVS//'

	case $(tty)(:t) in

I'd be somewhat discomfited by that.  What was the rationale for changing
that behavior, again?

} The other change related to ~ with EXTENDED_GLOB.  Before ~ was only
} treated as exclusion character if it was not at the end of the word and
} the word contained other glob characters.  This allowed you to write
} 
} ls *~
} rm foo~
} dd if=~/foo of=bar
} 
} etc.  None of these work anymore.

That loss is quite unpleasant.  I add my vote for fixing or backing out
that particular change.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: foo(:...) and foo~ glob
  1998-05-02 22:27 ` Bart Schaefer
@ 1998-05-03  3:22   ` Zoltan Hidvegi
  1998-05-05  8:53   ` Andrew Main
  1 sibling, 0 replies; 5+ messages in thread
From: Zoltan Hidvegi @ 1998-05-03  3:22 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> On May 2,  3:27pm, Zoltan Hidvegi wrote:
> } Subject: foo(:...) and foo~ glob
> }
> } After this change:
> } 
> } Sun Apr  5 20:00:40 1998  Andrew Main  <zefram@fysh.org>
> } 
> } the (:quals) syntax no longer works.
> 
> Does this also mean that either/both of the following are broken?
> 
> 	echo ${pref}**/CVS(:h) | sed 's/CVS//'
> 
> 	case $(tty)(:t) in

Perhaps I was not very clear.  Both of these works.  The (:...) syntax
triggers globbing, which means it does not work on words which are not
existing filenames.  The later $(tty)(:t) example works differently than
before, although you'll not notice it: zsh now looks at the disk if the
result of tty exists before applying the qualifier, while before the
qualifier was applied unconditionally.  Since ttyp gives you an existing
device, this does not make any difference here.  The difference is in
things like

echo asdfg(:s/g/h/)

gives you

zsh: no matches found: asdfg(:s/g/h/)

instead of asdfh if you do not have a file called asdfg in your current
directory.  Zefram is right in that the old behaviour was not very well
documented, which is really my fault, since I added this in 2.6-beta20.

Zoli


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: foo(:...) and foo~ glob
  1998-05-02 20:27 foo(:...) and foo~ glob Zoltan Hidvegi
  1998-05-02 22:27 ` Bart Schaefer
@ 1998-05-05  8:48 ` Andrew Main
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Main @ 1998-05-05  8:48 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

Zoltan Hidvegi wrote:
>the (:quals) syntax no longer works.  The idea was that foo(:...) should
>not do globbing if there are no wildcard, but it should execute the
>modifiers.

It was always documented as working on names of existing files.
It's useful functionality, of course, but...

>            This is very useful for general text manipulation.  Of course
>${${:-foo}:...} still works, but it's quite ugly.

But this is more meaningful, and how often are you actually applying
qualifiers to a literal string rather than a $ expansion?

I'm trying to keep this as simple and orthogonal as possible.  (:quals)
is part of the glob syntax, and ${:quals} is part of the parameter
expansion syntax.  The latter is the proper syntax for manipulation
arbitrary strings.

>ls *~
>rm foo~
>dd if=~/foo of=bar
>
>etc.  None of these work anymore.

Good point.  I'll change this back.

-zefram


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: foo(:...) and foo~ glob
  1998-05-02 22:27 ` Bart Schaefer
  1998-05-03  3:22   ` Zoltan Hidvegi
@ 1998-05-05  8:53   ` Andrew Main
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Main @ 1998-05-05  8:53 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer wrote:
>Does this also mean that either/both of the following are broken?
>
>	echo ${pref}**/CVS(:h) | sed 's/CVS//'
>
>	case $(tty)(:t) in

Those should still work, since you're dealing with actual filenames.
In the first case, you're globbing in either zsh version.  The second
one would be more efficient as "${TTY:t}" in either version.

>I'd be somewhat discomfited by that.  What was the rationale for changing
>that behavior, again?

Simplification -- parens trigger globbing.  The only casualty is the
`foo(:mods)' syntax, where `foo' is not a filename.  We gain the ability
to do `foo(.)' etc.

>} ls *~
>} rm foo~
>} dd if=~/foo of=bar
>
>That loss is quite unpleasant.  I add my vote for fixing or backing out
>that particular change.

Agreed.

-zefram


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-05-05  8:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-02 20:27 foo(:...) and foo~ glob Zoltan Hidvegi
1998-05-02 22:27 ` Bart Schaefer
1998-05-03  3:22   ` Zoltan Hidvegi
1998-05-05  8:53   ` Andrew Main
1998-05-05  8:48 ` Andrew Main

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).