Exception transparency
Nathan Bryant
nathan.bryant at linkshare.com
Tue Jun 8 08:47:34 PDT 2010
A simple example:
public @pure int sum(int a, int b) {
log.debug("sum!");
return a + b;
}
log.debug can never be strictly pure, but surely we don't want to
disallow it!
From: Paulo Levi [mailto:i30817 at gmail.com]
Sent: Tuesday, June 08, 2010 11:44 AM
To: Nathan Bryant
Cc: Brian Goetz; Reinier Zwitserloot; lambda-dev at openjdk.java.net
Subject: Re: Exception transparency
Why is it not workable? Do programmers have trouble understanding that
they can't use private methods outside of their class to give a foolish
example?
Why would they have problems understanding that they can only use "pure"
methods in the body of a pure function -recursive obvs? (aside, here you
can see why constructors, and SAM types are still useful, mark a method
as pure, but leave the constructor to deal with the impurity).
Seems like the most elegant solution, and frankly almost a requirement
for that the new parallel api's if they are to maintain a little sanity.
The alternative is to retrofit it later if the concept becomes
available, that will break code, and thus be used as a excuse to do
nothing, as usual.
More information about the lambda-dev
mailing list