comp.lang.ada
 help / color / mirror / Atom feed
From: Marc.Graham@SEI.CMU.EDU
Subject: An Ada Typing problem
Date: Wed, 2-Sep-87 12:38:45 EDT	[thread overview]
Date: Wed Sep  2 12:38:45 1987
Message-ID: <8709021638.AA19397@bx.sei.cmu.edu> (raw)

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 <x,y> 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.

             reply	other threads:[~1987-09-02 16:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-09-02 16:38 Marc.Graham [this message]
  -- strict thread matches above, loose matches on Subject: below --
1987-09-06 14:44 An Ada Typing problem Marc.Graham
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox