# Re: The BOOLEAN data type

From: Peter Koch Larsen <pkl_at_mailme.dk>
Date: 18 Apr 2003 08:15:26 -0700

Costin Cozianu <c_cozianu_at_hotmail.com> wrote in message news:<b7ncgr\$2odsj\$1_at_ID-152540.news.dfncis.de>...
> --CELKO-- wrote:

[large snip]

> What happened to that requirement ?
>
> Besides, three valued logic is totally unnecessary. You know the saying
> instead of feeding the hungry give him a fishing pole and teach him how
> to fish.
>
> If you support sum types (see the parallel thread), I don't need three
> valued logic, classic logic is enough.

Not sure I agree here.

>
> Using a decent type system , I can define a three valued logic boolean,
> in 5 lines of code and reuse it all over the place where I need. If I
> really need to I can dfine a fuzzy boolean data type in a hadnful of
> code and reuse it all over the place.

Yes - not that difficult.
>

1. Use a NULLABLE type. This could be an extension like the sum-type mentioned (i have not read that thread yet so i can not comment). I see no problems with that approach.
2. Use a DEFAULT value. This could be feasible in some situations, but in many situations it would not. The most obvious example would be if the field in question is boolean. Which default could you possible use?
3. Use a marker that existed independently of the field. This approach has so many flaws that I believe it to be infeasible. For one thing, what value should we store in that field? If we have ADT's we must be careful as the ADT might have some constraints, that if not set will invalidate the type - a CIRCLE could as an example be required a non-negative radius. Even non-ADT types might have some integrity constraints: think about a floating point number stored in the IEEE format.

Kind regards
Peter Received on Fri Apr 18 2003 - 17:15:26 CEST

Original text of this message