Koen Claessen, you wrote:
>
> Fergus Henderson <[EMAIL PROTECTED]> wrote:
>
> | Second, how do you handle syntax errors in the command line arguments?
> | What does lookupInt do if the integer overflows, or if the argument
> | is not valid syntax for an integer? Do you check for misspelt or
> | invalid option names?
>
> The point Simon made is that you can still use all of the old stuff. You
> can still define a function
>
> getArgs :: IO Args
> getArgs = return args
>
> if you wish.
Yes, but my point is that if making argv a constant would encourage
people to write bad programs, then it is probably not a good idea.
And programs that do not check for misspelt option names are *bad*.
I would find Simon's arguments more convincing if he showed
a convenient idiom that did things properly, rather than a
convenient way to write broken programs.
(Doing it properly is probably not too hard, but I'll leave it up to
the proponents of this proposal to demonstrate this...)
> I've always thought it is a good idea to make them a constant; what is the
> point in having an IO function that always returns the same result?
Well, they *don't* always return the same result, in fact they will
usually have different results for each invocation of the program.
In fact, now that you mention it, I think that this proposal could
possibly have some negative impacts regarding certain implementation
techniques. For example, an interpreter is going to have to do
reinitialize all CAFs -- or at least the ones that depend on argv --
at the start of each program run. Currently that's not the case.
So this proposal would increase the difficulty of implementation,
at least for some implementation techniques.
--
Fergus Henderson <[EMAIL PROTECTED]> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED] | -- the last words of T. S. Garp.