Re: What databases have taught me

From: Dmitry A. Kazakov <>
Date: Sat, 1 Jul 2006 22:24:17 +0200
Message-ID: <parxewkc6z2q$.urpraa0eaixo$>

On 1 Jul 2006 11:40:11 -0700, Marshall wrote:

> So, the probems with this approach are pretty well-known.
> Can you say what you consider to be the benefits? And
> perhaps also why these benefits outweigh the costs?

As for costs, well, I really don't know if there are any.

Benefits are clear. You have a more regular language. There is nothing special in results. They are just out-parameters. You can have overloaded parameterless function. Consider:

function Random return Natural;
function Random return Float; -- This is legal Ada

You can have abstract factory and input operations all overloaded. No problem:

X : String := Read (File);
Y : Integer := Read (File); -- This is legal Ada

There is a lot of inference which can be made if context is used. Consider the following:

Z : String (1..80) := (2=>'A', 5=>'B', others=>'X'); -- Legal Ada

Note that the constraint 1..80 is the context which allows to use "others". If there were no context, the above should be rewritten as:

Z : String (1..80) := (1 =>'X', 2=>'A', 3..4=>'X', 5=>'B', 6..80=>'X');

Note also that it could be:

procedure Foo (Size, Index : Integer) is

   Z : String (1..Size) := (Index=>'A', others=>'X');

Then you can share literals between multiple numeric types. Consider the following:

type My_Int is range 1..256;

X : Integer := 1; -- Legal 1 is resolved to Integer (1) Y : My_Int := 1; -- Legal 1 is resolved to My_Int (1)

if X = Y then -- Type error. 1 of Integer is not 1 of My_Int X := Y; -- Type error

As you see it gives you safety as well.

Dmitry A. Kazakov
Received on Sat Jul 01 2006 - 22:24:17 CEST

Original text of this message