Hi Jason! * Jason Dagit <[EMAIL PROTECTED]> [081030 19:42]: > Okay, since you've opened the door for comments :) I'll put on my > nitpickers hat and comment here.
Yay for the nitpickers :)
>
> + let myenv =
> [("HOME",cwd),("PWD",cwd),("EMAIL","tester"),("DARCSEMAIL","tester"),("PATH",(darcs_path++":"++path)),("DARCS_DONT_COLOR","1"),("DARCS_DONT_ESCAPE_ANYTHING","1")]
>
> We don't seem to have any hard and fast rules about line length, but
> this one does seem overly long. This might be a bit easier for
> people:
> + let myenv = [("HOME",cwd),("PWD",cwd),("EMAIL","tester")
> + ,("DARCSEMAIL","tester"),("PATH",(darcs_path++":"++path))
> + ,("DARCS_DONT_COLOR","1")
> + ,("DARCS_DONT_ESCAPE_ANYTHING","1")]
>
There does not need to me a rule, the above is indeed ugly, agreed.
> I think we can make this a bit simpler:
> +set_env :: [(String,String)] -> [(String,String)] -> [(String, String)]
> +set_env [] env = env
> +set_env (e:es) env = set_env es (set_env_helper e env)
> + where set_env_helper :: (String,String) -> [(String,String)] ->
> [(String, String)]
> + set_env_helper (key, val) env = nubBy (\(x,_) (y,_) -> x ==
> y) ((key,val):env)
>
> The way nubBy works is that it will remove all duplicates and we
> really only need to run it once the way you've structured the code.
> Untested, but I think what you've written is equivalent to this:
> +set_env es env = nubBy (\(x,_) (y,_) -> x == y) (es ++ env)
Oh, this is nice! I like it.
>
> By the way, have you tried using your code in place of the existing
> shell_harness to see that everything works?
>
I did, it fails the same tests on my system as the original harness
did but I don't think this suffices. Further tests are needed by
adventurous darcs hackers once this script is in shape. I will ask
for that later.
Thanks for your comments!
Christian
--
You may use my gpg key for replies:
pub 1024D/47F79788 2005/02/02 Christian Kellermann (C-Keen)
pgpxkHdK5sMpe.pgp
Description: PGP signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
