Christoph Karl Walter Grein

The time for my revenge had come. Oh, how well I remembered what Lady Ada had done to me on my last visit. So I called on her in anticipation of triumph.

The sight of her new house left me speechless - my word, hadn't it changed! Well, I did already know the building plans, but to see it with my own eyes was something quite different. Her old house (year of construction 83) had been compact, built in traditional style, geared to efficiency. There had been 14 spacious rooms, 3 extensions, and 3 storerooms. Now however, she resided in a veritable palace (yoc. 95) with turrets and oriels, a phantastic sight to behold.

"How nice of you to drop in again," Lady Ada welcomed me with a hearty smile. "How do you like my new house? Would you like to have a look around?"

"My compliments to the architect," I replied. "Oh, I had quite a few of them, all among the best. The interior designer, also, did an excellent job, as you'll see presently," she said.

She was not exaggerating. Now there were only 13 rooms left, the missing room was exchanged for 8 extensions, 1 further room filled with useless junk from the old house, and 5 storerooms. The interior furnishings were a feast for the eyes. Lying around everywhere were objects of various size, shape and form, whose purpose was not immediately clear to me. Patiently, Lady Ada explained each and every one to me. Scarcely had she touched an object when it at once changed form and function. "Well, polymorphism - it changes to fit the needs of the moment."

Finally, my head already reeling, she asked me for the reason of my visit. "Let's sit together for a glas of wine, then we can discuss the problem," she invited me. The words "Oh no, you don't!" escaped from my lips. "I still have a headache from last time." Lady Ada laughed loudly. "Come on, it wasn't that bad."

"Yes, it was!" I objected, "That's exactly the reason for my visit. The score has not yet been settled. And please don't wave your magic wand like that, it makes me nervous."

"Well," I began, "I propose you a little wager. If I win, you reissue the invitation, this time without any of your tricks."

"And if you lose?" Lady Ada wanted to know. "Oh, anything you like - I can't lose this bet. But in case I do, I'll produce only Java Byte Code in the future."

"Isn't that a bit stiff?" - "Of course not. You're forgetting that one can produce Java Byte Code with Ada." Lady Ada giggled happily and asked: " Now what's this all about?"

To keep her a bit on tenterhooks, I fished out a sheet of paper and slowly scribbled the following on it:

1 < 0

The lady looked at me, uncomprehending. "If you prefer, I can also formulate it like this," I said and added the following:

1 < 0
-1 = 1

"On something like this you dare bet with me, the very person after all who invented programming?" she raised her magic wand mischievously. "But accepted! - If you are hell-bent to program in Java, fire away!"

"The type Boolean is defined as an enumeration type with the literals False and True, where False < True holds. This is in agreement with the fact that from a false presupposition, you can prove anything: False ⇒ True, which in Ada, funny as it may look, is written False <= True.1 The numeric values used implicitly as the representation of the literals remain unspecified in the Ada Reference Manual 2. Under normal conditions, this should not bother us. However, when for some reason or other the internal representation should really be important (perhaps some external device affords a special representation), we can force it:

Also the following is possible:

Should it become nessecary, we can also specify the length of the representation:

Now let's consider a two's complement machine. Here, -1 is represented as a sequence of bits ... " (bored, Lady Ada yawned extensively, but I continued unmoved) "... which consists of ones only, e.g. for a number in 16 bit format 3:

But wait, for one bit we have at our disposal only the values -20..20-1, this is -1..0. Here -1 is represented as one bit with the value 1, the number consists, so to speak, of its sign only:

Thus for T1'(A) < T1'(B) evaluate 0 < 1, for T2'(A) < T2'(B) however 1 < 0. Both times you, dear Lady Ada, produce the same result: True!"

Lady Ada was speechless, her magic wand rooted to the last line. Then she exploded with laughter: "Well, for this priceless April Fool's trick you have fully earned a special meal!" We proceeded to have a charming evening.

Ted Dennison and his wife did me the pleasure to polish my raw English translation.

1 With the set theoretical designation False ⊆ True, this nearly looks like Ada syntax again.

2 Except for the discussion in the Annotated Ada Reference Manual 13.4, especially paragraph (8b), to take the values of the 'Pos attribute (0 for False, 1 for True). Often all zeros is used for False, all ones for True. This is legal as long as it is compliant with the sequence of the enumeration type definition.

3 Their range of values is -215 .. 215-1 (generally for n bits -2n-1 .. 2n-1-1); the first bit always specifies the sign.
(I deliberately do not use the Ada designation 2#1111_1111_1111_1111#, because this would denote the number 216-1.)

Ada Magica
       © Copyright 2000 C.K.W. Grein