From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!cit-vax!ucla-cs!zen!ucbvax!SEI.CMU.EDU!Marc.Graham From: Marc.Graham@SEI.CMU.EDU Newsgroups: comp.lang.ada Subject: An Ada Typing problem Message-ID: <8709021638.AA19397@bx.sei.cmu.edu> Date: Wed, 2-Sep-87 12:38:45 EDT Article-I.D.: bx.8709021638.AA19397 Posted: Wed Sep 2 12:38:45 1987 Date-Received: Sat, 5-Sep-87 06:41:53 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: I would like to determine if Ada can be made to handle NULL values in an elegant, efficient way. The problem arises in interfacing a database language (namely SQL) and Ada. In brief, I would like to define a type which properly includes all values and operations of the predefined (package STANDARD, appendix F) type INTEGER and also includes one new value: NULL. The rules of arithmetic remain unchanged for values in INTEGER. The rule extending to NULL is: any operation involving the NULL value returns the NULL value. I want the solution to have the following properties: any expression valid for objects of type INTEGER is valid for objects of the new type. The solution must be ***very efficient at run time*** and reasonable at compile time. Run time efficiency includes: evaluation of arithmetic operations; conversion costs. For the conversion problem: Assume the DBMS delivers (and expects) values in the form of pairs where y is an indicator and takes on some special value when the value represented is null; otherwise, the value represented is the value of x. ***Make no assumptions about x and y (e.g. length in bits, encoding scheme, etc)***** Can a solution requiring ****zero**** runtime conversion costs be produced? Mail your solutions to me (marc@sei.cmu.edu) or, more interestingly, post them here for comments.