[darcs-devel] Greetings and some questions

Tommy Pettersson ptp at lysator.liu.se
Mon Oct 2 13:10:58 PDT 2006


On Mon, Oct 02, 2006 at 12:26:03PM -0700, David Roundy wrote:
> Just to argue the other side (once again--it occurred to me just as I sent
> that last message), an advantage of an abstraction layer would be that even
> though the name is essentially identical to the raw string, the type
> checker would force you to get it right, which is often right.  I'm
> ambivalent on this question at this stage...

Yes, type checking (or identifier look-up if it's a variable or
#define in another language) is a good thing. When strings are
used as symbols they are better represented as symbols, as darcs
is already doing when it parses the options and defaults files
and creates the list [DarcsFlag].

I don't propose we should change

  fooFlag `elem` opts

to

  "--foo-flag" `string_elem` opts

I just don't think we should change

  putStr "use the --foo-flag option"

to

  putStr "use the"++option_name fooFlag++" option"

If fooFlag was changed to barFlag, the abstracted putStr
versions would give a compilation error. But it's a quite heavy
machinery for something that is not going to happen very often
and not causing any real problems when it happens. The compiler
output could be used to spot any missed replaces, but a grep
listing is easier and faster, and catches occurrences the
compiler misses, like comments.


-- 
Tommy Pettersson <ptp at lysator.liu.se>




More information about the darcs-devel mailing list