guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Command line processing opens up can of worms :>


From: Marius Vollmer
Subject: Re: Command line processing opens up can of worms :>
Date: 29 May 2001 22:22:49 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102

Dirk Herrmann <address@hidden> writes:

> IMO, it is not of much use to provide an additional way of quoting
> to emulate shell behaviour.  It may even be confusing, since it will
> always be a strange mixture of syntaxes.

But it is easy to understand once you know about it and doesn't have
the overhead that read-then-write has.

> Thus, I'd stay with saying, that the arguments will be read with
> (read).  We could still require that explicit quotes would have to
> be used.

How do you mean?  Using `read', but only allowing arguments that read
as strings, symbols or numbers?

> The idea to use the read/write-to-string approach can offer some nice
> possibilities, though.

But only from the meta arguments, not from a command line.  Using
fancy stuff in the meta arguments is probably not very useful, since
you could do the fancy stuff much cleaner in the script itself.

A solution to this unsymmetry would be to also filter command line
arguments thru `read'.  I wouldn't want to do that.  This is just not
how command line arguments are expected to behave.  You can map `read'
over them quote easily yourself in your argument processing code if
that is what you want.

> Assume that some program expects a number parameter, and you would
> like to pass the constant pi.  Withough this approach you would have
> to type "3.14159.." with as many digits as you remember.  But, using
> the #, syntax extension, you might just be able to write #,(pi), and
> let write-to-string produce a printed representation of pi with
> maximum accuracy.

Suppose you want to pass the string "1e3", but it gets turned into
"1000" unless you use quotes.  I would find this also confusing.


I'd say that using `read' to parse arguments is a valid and often
useful thing, but it should be done under the control of the
programmer who knows what a specific argument is supposed to mean and
that it makes sense to filter it thru read.  This is easy enough to do
in Scheme.

Collecting arguments from the `meta' section should be simple and not
involve `read' unconditionally.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]