[Nix-dev] Re: tryCatch function: tryRethow ?

Michael Raskin 7c6f434c at mail.ru
Sat Jan 3 12:47:01 CET 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicolas Pierron wrote:
> In fact, I don't see much drawback.
> 
>> So I vote for reducing functionality to force
>> rethinking implementation if a need arises.
> 
> What do you mean ?
> I have made this because I need this trick to handle error messages
> inside NixOS.  I think this feature is general, very small and provide
> separation of concerns like somebody told me in an other post (why is
> there a name argument to the merge function ?).

Hm, adding position information really looks nice. But that was not my
point.

1. tryRethrow would be enough for your application
2. tryRethrow is automatically limited only to the uses that you want
3. tryCatch can be used to replace some if-based choices of which
dependency variant to use
4. It looks like nobody is sure how should tryCatch behave for that case.
5. If some functionality is missing in Nix and a need arises, the
solution to fully fit the problem at hand is searched. If Nix has some
functionality that is almost fitting, there is a strong compatibility
incentive to craft a complex solution to use the old functionality.

If we want to have a general tryCatch system, then does anyone have
ideas what exactly should it provide to catcher function? Maybe, for
example, it should inform us whether the failure was inside the
top-level function call or inside parameter evaluation?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQEcBAEBAgAGBQJJX1A0AAoJEE6tnN0aWvw3PacH/1E0Vaa9Ytf2eimzjrrBp2Y8
SUbiQzcU10fGNJsTYsNhMFPQF13OlSYs1nejLASpx34lNzVAjALcd0KWIAKL3psW
TuurR4N667uqJYSkRNp1LTFfFrdKXFZmE9txTaEX8AyQpy9vgdVItx3+/a5AutRp
S5/g/1srkhZfi0e9t9WZT3DETzgRDYS3cPtnSXAIM1XPU3KPWZMA7EIqWNOcCD7g
YEbLBQ6HiNhU/c1Mmi4y31WPVNMUCOKgL9SM4AM6M2NE5ROxY7jRn9oMQnCIwgPB
kOoqcYII10ILccqJ+GPYQkW6tdU9S9B3eP/8sztaHeEEfoszEX5/Hf0O03ks+Pk=
=XBmN
-----END PGP SIGNATURE-----



More information about the nix-dev mailing list