From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 10 Dec 92 22:57:32 GMT From: aio!dnsurber@eos.arc.nasa.gov (Douglas N. Surber) Subject: Suggestion for multivalue boolean case for 9X Message-ID: List-Id: How many times have you seen code like the following: if cond_1 then if cond_2 if cond_3 then s_t_t_t; else s_t_t_f; end if; else if cond_3 then s_t_f_t; else s_t_f_f; end if; end if; else if cond_2 if cond_3 then s_f_t_t; else s_f_t_f; end if; else if cond_3 then s_f_f_t; else s_f_f_f; end if; end if; end if; I find this hard to read and even harder to maintain. Cond_3 appears four times. That's a maintenance nightmare. A case statement that worked on arrays of booleans would be a big improvement. Something like the following: case (cond_1, cond_2, cond_3) is when (true, true, true ) => s_t_t_t; when (true, true, false) => s_t_t_f; when (true, false, true ) => s_t_f_t; when (true, false, false) => s_t_f_f; when (false, true, true ) => s_f_t_t; when (false, true, false) => s_f_t_f; when (false, false, true ) => s_f_f_t; when (false, false, false) => s_f_f_f; end case; I don't know if it's too late to consider this for 9X, but I think it would be neat. The compiler could verify that you had covered all of the cases and not listed any case twice, etc. I suppose it could be generalized to work on arrays and records of discrete types. That might be even better. Yes I know you could implement a function to turn an array of bools into an enumeration type or an integer, but that is less clear. Anyway, just an idea. Douglas Surber Lockheed Houston, TX