You can make the exact same argument about *any* type. The point of
*any* type is to restrict the possible set of values.
Unfortunately, prohibiting null everywhere turns out to be a major
PITA in practice.
On Thu, Dec 4, 2008 at 12:43 PM, Francisco Jose Peredo
<franciscoperedo(a)tabasco.gob.mx> wrote:
Yes, but I have always felt uneasy about a null boolean thing... the
point of boolean is to restrict the possible outcomes of something to
"true" or "false", but with a nullable boolean we now have 3
possible
outcomes "true", "false" and "undefined"... and the problem
is that
"undefined" is also "typeless" and therefore bug prone, the code:
if(isUserInRole("administrator)){
//do something
}
else {
//do something else
}
looks like something perfectly valid, but it turns out it can crash
because isUserInRole can return null.
I mean I can understand it for MailComponent.getBoolean, and
org.jboss.seam.ui.util.JSF.getBooleanValue, but I don't like it for
org.jboss.seam.ui.graphicImage.Image.isRatio or
org.jboss.seam.web.IsUserInRole.isUserInRole.
Wouldn't it be better to use an Enum if there are 3 or more possible
outcomes?
Regards,
Francisco
>
>>
>>
>> Regards,
>>
>> Francisco
>>
_______________________________________________
seam-dev mailing list
seam-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/seam-dev
--
Gavin King
gavin.king(a)gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org