comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Ada.Command_Line and wildcards
Date: Tue, 06 Mar 2007 07:08:33 -0800
Date: 2007-03-06T07:08:33-08:00	[thread overview]
Message-ID: <ygey7mawgsu.fsf@hugsarin.dmusyd.edu> (raw)
In-Reply-To: 1173185771.11841.69.camel@localhost

Georg Bauhaus wrote:

> Unlike Ada, Unix favors the *writer* over the reader. No surprise I
> think. But damn right?

Considering that the Unix shell is created for _interactive_ use, this
is certainly not a surprise.

But with our new, fancy, interactive shells (like Zsh) it may be time
to paraphrase Preben Randhol's signature:

   Saving keystrokes is the job of the interactive shell, not the
   programming language.

With GNU tools I generally use the long version of the command line
arguments.  In interactive use it is not significantly (if at all)
slower than the short versions, since Zsh helps quite a lot.  And in
programs it improves readability.

> When it comes to echo *.ads, a decision was necessary as to what
> should happen when there is no matching file name. The choice was
> not: reflect this fact and produce the empty result.

Which might have been nice.

> I wouldn't mind programs that just read their arguments unexpanded
> and call the OS expansion service, an iteration device for example.

If that is _the_ way to scan a directory for files, it may be possible
to get (practically) all programmers to use it, and thus give a
uniform file name pattern expansion service.  But what rules should
this uniform service follow?  Just plain old fashioned globbing?  Or
the extended Zsh version?  Or something completely different?  Can we
make the pattern matcher user selectable?  (Programs would of course
have to select one, to work consistently with internal patterns.)

> And if there is no matching thing, then *every* program consistently
> produces empty results!

Yes. :-)

> One difference, then, is that an ls will consistently produce
> nothing for no argument. This will require more typing when you want
> something, for example ls -d "*".

Couldn't one just expand the rules for "ls", so calling it with the
name of a directory corresponds to "ls <dir>/*" (in globbing terms)?
Since no explicit directory means ".", then "ls" will correspond to
"ls ./*" and work like the more lazy of us would like it to.

This would be different from calling "echo" without any arguments.
But it would be so because of the _meaning_ of the arguments.

> I don't think any Unix programmer will see the benefits of more
> typing. But having gone some way through the Ada experience I think
> this the right thing.

With a sufficiently smart interactive shell, we can probably cut down
on the typing at the same time as we improve the handling of big
directories.

> Or with this change, if calls to the expansion service should not be
> part of Unix programs, why not have
>
> $ ls $(expand "*.ads")

Much too long to type.  And it wouldn't solve the "too many arguments"
problem.  If there should be configurable file name pattern matching,
I would rather do it using an environment variable:

   FILE_NAME_EXPANSION=globbing ls *.ads

> (I'm not a fan of large directories when we do have a hierarchical
> filing system, but again, who am I to suggest that a program be
> redesigned to use a hierarchy of directories for file storage.)

When I store more than 10_000 messages from comp.lang.ada; how should
I distribute them in a hierarchy of directories?  I might for example
need to grep them for Preben's signature.

> For large jobs, ed(1) is the most efficient editor

For some reason I just use vi(1) and sed(1).

Greetings,

Jacob
-- 
�When in Rome; burn it�                        -- Diziet Sma




  parent reply	other threads:[~2007-03-06 15:08 UTC|newest]

Thread overview: 158+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 20:43 Ada.Command_Line and wildcards Gautier
2007-02-21 20:59 ` (see below)
2007-02-22  1:13   ` Marc A. Criley
2007-02-22  2:08   ` Adam Beneschan
2007-02-22  5:59     ` (see below)
2007-02-22  8:16   ` gautier_niouzes
2007-02-22 10:25     ` Simon Wright
2007-02-22 11:02     ` Alex R. Mosteo
2007-02-24  6:34       ` Martin Krischik
2007-02-24 11:46         ` Markus E Leypold
2007-02-24 14:54           ` Georg Bauhaus
2007-02-24 16:45             ` Markus E Leypold
2007-02-24 20:08               ` Jacob Sparre Andersen
2007-02-24 20:45                 ` Georg Bauhaus
2007-02-25  0:39                   ` Björn Persson
2007-02-25 16:29                   ` Martin Krischik
2007-02-24 20:26               ` Georg Bauhaus
2007-02-25  7:46               ` Hyman Rosen
2007-02-25 13:19                 ` Georg Bauhaus
2007-03-05  1:07             ` Brian May
2007-03-05  1:39               ` Markus E Leypold
2007-03-06  3:48                 ` Brian May
2007-03-05 12:16               ` Georg Bauhaus
2007-03-05 13:20                 ` Markus E Leypold
2007-03-06 12:56                   ` Georg Bauhaus
2007-03-06 15:07                     ` Markus E Leypold
2007-03-07 22:06                       ` Georg Bauhaus
2007-03-08  5:07                         ` Simon Wright
2007-03-08  9:19                           ` Markus E Leypold
2007-03-08  9:28                           ` Georg Bauhaus
2007-03-08  9:16                         ` Markus E Leypold
2007-03-09 13:33                           ` Georg Bauhaus
2007-03-09 17:11                             ` Markus E Leypold
2007-03-09 18:22                               ` Dmitry A. Kazakov
2007-03-09 19:02                                 ` Markus E Leypold
2007-03-09 20:04                                   ` Dmitry A. Kazakov
2007-03-10 10:40                                     ` Markus E Leypold
2007-03-11  0:15                                 ` Hyman Rosen
2007-03-11  7:59                                   ` Dmitry A. Kazakov
2007-03-11 14:55                                     ` Markus E Leypold
2007-03-12 13:32                                     ` Hyman Rosen
2007-03-12 14:14                                       ` Dmitry A. Kazakov
2007-03-12 15:08                                         ` Markus E Leypold
2007-03-16  8:06                                           ` Brian May
2007-03-16 12:53                                             ` Markus E Leypold
2007-03-10  2:12                               ` Randy Brukardt
2007-03-10 10:52                                 ` Markus E Leypold
2007-03-10 15:48                               ` Georg Bauhaus
2007-03-10 18:11                               ` Jacob Sparre Andersen
2007-03-10 18:42                                 ` Markus E Leypold
2007-03-12 14:25                                   ` Jacob Sparre Andersen
2007-03-12 15:17                                     ` Markus E Leypold
2007-03-09 13:41                       ` Robert Deininger
2007-03-09 17:15                         ` Markus E Leypold
2007-03-09 18:58                           ` Larry Kilgallen
2007-03-10 10:27                             ` Markus E Leypold
2007-03-06 15:08                     ` Jacob Sparre Andersen [this message]
2007-03-07 19:21                     ` Hyman Rosen
2007-03-07 20:27                       ` Markus E Leypold
2007-03-07 21:12                       ` Georg Bauhaus
2007-03-06  3:07                 ` Brian May
2007-02-24 18:28           ` Martin Krischik
2007-02-24 13:04         ` Larry Kilgallen
2007-02-24 16:16           ` Markus E Leypold
2007-02-25 14:18             ` Larry Kilgallen
2007-03-05  1:03         ` Brian May
2007-03-05 10:34           ` Martin Krischik
2007-03-05 20:46             ` Simon Wright
2007-02-22 11:19     ` Jean-Pierre Rosen
2007-02-22 13:49       ` Maciej Sobczak
2007-02-22 14:25         ` Jean-Pierre Rosen
2007-02-22 15:12           ` Larry Kilgallen
2007-02-22 15:15           ` Ludovic Brenta
2007-02-22 15:54             ` Dmitry A. Kazakov
2007-02-22 18:26               ` Markus E Leypold
2007-02-22 19:34                 ` Dmitry A. Kazakov
2007-02-22 20:38                   ` Simon Wright
2007-02-23  8:43                     ` Dmitry A. Kazakov
2007-02-25 16:35                 ` wildcards with unix shells Martin Krischik
2007-02-22 16:20             ` Ada.Command_Line and wildcards Jean-Pierre Rosen
2007-02-22 18:34               ` Markus E Leypold
2007-02-22 19:30                 ` Niklas Holsti
2007-02-23  1:01                 ` Randy Brukardt
2007-02-23  4:44                   ` Jeffrey R. Carter
2007-02-23  5:06                   ` Anders Wirzenius
2007-02-24 16:37                     ` Simon Wright
2007-02-25 16:42                       ` Martin Krischik
2007-02-26 20:51                         ` Simon Wright
2007-02-27  7:11                           ` Martin Krischik
2007-02-27 21:32                             ` Björn Persson
2007-02-27 21:56                               ` Georg Bauhaus
2007-02-27 22:53                                 ` Markus E Leypold
2007-02-28 13:55                                   ` Georg Bauhaus
2007-02-28 14:25                                     ` Markus E Leypold
2007-02-26 11:59                       ` Anders Wirzenius
2007-02-26 14:46                         ` Larry Kilgallen
2007-02-23  8:43                   ` Jacob Sparre Andersen
2007-02-23 11:34                     ` Jean-Pierre Rosen
2007-02-24 13:40                       ` Jacob Sparre Andersen
2007-02-25 16:57                     ` Martin Krischik
2007-02-26 21:27                       ` Björn Persson
2007-02-27  7:18                         ` Martin Krischik
2007-02-23  8:49                 ` Jean-Pierre Rosen
2007-02-23  9:29                   ` Jacob Sparre Andersen
2007-02-22 17:07       ` Adam Beneschan
2007-02-22 18:40         ` Markus E Leypold
2007-02-23 10:47         ` Rob Norris
2007-02-23 13:28         ` brian.b.mcguinness
2007-02-23 13:56           ` Georg Bauhaus
2007-02-23 17:10           ` Adam Beneschan
2007-02-22 20:12       ` Gautier
2007-02-23  1:15       ` Robert A Duff
2007-02-23  9:25         ` Jacob Sparre Andersen
2007-02-24  1:18           ` typed pipes (was: Ada.Command_Line and wildcards) Björn Persson
2007-02-24  8:16             ` typed pipes Dmitry A. Kazakov
2007-02-24 13:37             ` Jacob Sparre Andersen
2007-02-24 16:33               ` Björn Persson
2007-02-24 20:17                 ` Jacob Sparre Andersen
2007-02-25  1:11                   ` Björn Persson
2007-02-25  7:03                     ` Jacob Sparre Andersen
2007-02-23 14:45         ` Ada.Command_Line and wildcards Larry Kilgallen
2007-02-24 19:24           ` Robert A Duff
2007-02-25  6:29             ` Hyman Rosen
2007-02-25 12:21               ` Robert A Duff
2007-02-25 16:22                 ` Pascal Obry
2007-02-25 16:44                   ` Dmitry A. Kazakov
2007-02-26  5:03                     ` Hyman Rosen
2007-02-26  8:44                       ` Dmitry A. Kazakov
2007-02-26 17:11                         ` Hyman Rosen
2007-02-26 17:34                           ` Markus E Leypold
2007-02-27 16:13                             ` Georg Bauhaus
2007-02-27 16:19                               ` Markus E Leypold
2007-02-27 16:39                                 ` Georg Bauhaus
2007-02-27 17:56                                   ` Markus E Leypold
2007-02-27 20:29                               ` Randy Brukardt
2007-02-26 20:30                           ` Dmitry A. Kazakov
2007-02-27  0:34                       ` Randy Brukardt
2007-02-27 14:52                         ` Hyman Rosen
2007-02-27 20:43                           ` Randy Brukardt
2007-02-27 20:56                           ` Dmitry A. Kazakov
2007-02-25 17:50                 ` Jeffrey R. Carter
2007-02-23 16:58         ` Adam Beneschan
2007-02-23 19:12           ` Hyman Rosen
2007-02-23 19:26             ` Adam Beneschan
2007-02-25 17:05               ` Martin Krischik
2007-02-24  1:19           ` Björn Persson
2007-02-24  3:46             ` Adam Beneschan
2007-02-24 11:42               ` Markus E Leypold
2007-02-25 17:02             ` Martin Krischik
2007-02-23 19:04         ` Hyman Rosen
2007-02-23 19:30           ` Adam Beneschan
2007-02-23 19:46             ` Dmitry A. Kazakov
2007-02-23 20:07             ` Markus E Leypold
2007-02-24  1:18             ` Björn Persson
2007-02-24 19:22           ` Robert A Duff
2007-02-24 20:26             ` Dmitry A. Kazakov
2007-02-25  7:32             ` Hyman Rosen
2007-02-21 21:43 ` Dr. Adrian Wrigley
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox