comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: Re: Surprise in array concatenation
Date: Tue, 06 Sep 2005 13:52:53 +0200
Date: 2005-09-06T13:52:03+02:00	[thread overview]
Message-ID: <431d82e3$0$24147$9b4e6d93@newsread4.arcor-online.net> (raw)
In-Reply-To: <3ufj318nkubi.a5j4dbvaofhc.dlg@40tude.net>

Dmitry A. Kazakov wrote:

> Inconsistency means that you can derive P and ~P.

It's you who says this, stipulating the universal applicability
of binary logic. How can I justify that I can only derive
P from {}, and not ~P? Because it turns out to be useful.
Not because the derivation works.


> So far, there were no
> evidences that the world doesn't obey logic.

Tons. Starting at those things for which there is no explanation.
But we don't have a proof that the world is (binary) logical.
Wittgestein has made an attempt, but (of course) he had to give
up (shut up, in a sense, using an abbreviation of his own words).

BTW, people can say P now and ~P at another time, and this causes
very little mental stress.



>>We can agree on someting.
>>(As I said, HALT is the limit, I think we cannot even formally
>>decide, mathematically, whether consistency is consistent.)
> 
> 
> You cannot express the sentence above in a formal language. Which does not
> imply its undecidability. Only proper propositions can be decidable or not.

If the world is logical, as you claim, then our sentences
cannot be illogical, thus our sentences must be proper
propositions, thus decidable.


> You better show a case where [mathematically] inconsistent program could be
> usable. [Windows does not count! (:-))]

Inconsistent with what? Empty arrays having A'First > A'Last
are ubiquituous; I understand you find this inconsistent.

>>>>We have
>>>>lo, hi: arrays -> I,

> If hi and lo are just arbitrary values

I said, hi and lo are functions. I didn't say that they are
arbitrary.


> hi and lo are bounds, as such they have definite contracts. They cannot be
> "just" values. Once you formulate the contract, it will be pretty easy to
> show whether it is consistent = no any properly constructed array object
> violates the contract. It is not rocket science, really...

You have to know the contract of 'First etc. I see they can be surprising,
but I don't see a violation of Ada's well working contracts in
'First > 'Last.


>>Use subtypes. Computers are finite, so are types.
> 
> 
> I don't know what a finite type is. You might mean the domain set of a
> type. Then you are wrong, the sets of values of Ada's universal types
> aren't finite.

Ada's types in a real computer program are finite, no matter what.
Any value in an Ada program is finite due to de facto capacity
constraints.

> You can have a type which values comprise an uncountable set
> of any cardinality [I cannot tell for unreachable cardinals, though (:-))]

I very much doubt that any executable program has ever succeeded in
exstablishing a type representing an uncountable set, other than
symbolically, or by turning it into a countable finite thing, by way
of lazy evaluation.

> It is not the same as to be able enumerate all these values in one program!

For any infinite type,
there needs to be an algorithm or a declaration capable of constructing
the values in the type. For infinite types, the algorithms and declarations
don't exist.

> There is no any limitation on how bit patterns are mapped to the type
> values.

A limit on which items can be mapped to bit patterns is storage capacity.
Storage capacity is a worldly item << infinity.


> I can have 0000->Pi, 0001->e, 0010-><whatsoever>.

I did answer this.

>>>What I want is freedom.
>>
>>Then choose not use empty arrays, or test for 'length = 0, or
>>build your own array abstraction, use use Ada.Containers.Vectors,
>>.... or do not use Ada.
> 
> 
> Ah, that's your definition of freedom... (:-))

I won't ask language designers to rebuild their language
just because I prefer a certain, allegedly more consistent,
design of arrays, preferred by some in some algorithms,
not preferred by others.

 Is it so much better to introduce ubiquituous case distinctions
('Length = 0?) in every (sub)array algorithm just because there happens
to be a mathematical property that may be applied to indexes, forcing
A'First > A'Last to be a bad thing?


> It sounds as if the whole language design would collapse if empty arrays
> were constructed otherwise [properly.] Do you really believe in that?

Sure a lot of algorithms will collapse if they have to adopt your
consistency rules. If you dislike Ada's arrays, that's o.K..

If you claim to have found the only true rule stating what kind of arrays
are consistent with the rule and what kind isn't, then this sounds
like the RM has had inconsistent arrays for a number of years now.
Shouldn't there be an article somewhere that points out the erratic
definitions of array bounds in Ada 83, Ada 95, and the upcoming Ada 05?


> Did I say that?

If you insist on A'First <= A'Last, then it sounds like you want
to restrict Ada's attributes.


> The idiom you trying to push for has a clear application area. This area is
> *narrower* than one of the array idiom.

What is "_the_ array idiom"?

The few array types in some languages that I know don't seem to
have a problem with 

  "The Last Ones Shall be First"



> Then with "off"-values or without them, A'Last shall *not* be less than
> A'First.

Should this sentence start with "Thou shalst not do what everyone else
does"?


> Presently the case A'Last < A'First is used to indicate that there
> is no bounds.

That's wrong, in that it just indicates that A'Last < A'First yields
an empty range.

> It is a quite silly way to handle errors. Instead of an
> immediate response you return nonsensical values

What nonsensical values are returned in text like "3 .. 1"?

result := default_value;
for k in 3 .. 1 loop
 result := x(k);
end loop;

How could this be improved using

if x'length = 0 then
  result := default_value;
else
  for k in 3 .. 1 loop
   result := x(k);
  end loop;
end if;




  reply	other threads:[~2005-09-06 11:52 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-01  3:16 Surprise in array concatenation Gene
2005-09-01  7:55 ` Dmitry A. Kazakov
2005-09-01  8:02   ` Florian Weimer
2005-09-01 11:48     ` Georg Bauhaus
2005-09-01 12:02       ` Lutz Donnerhacke
2005-09-01 13:01         ` Georg Bauhaus
2005-09-01 15:54       ` Florian Weimer
2005-09-01 16:09     ` Robert A Duff
2005-09-05  8:38       ` Jean-Pierre Rosen
2005-09-05 23:52         ` Robert A Duff
2005-09-06  9:03           ` Jean-Pierre Rosen
2005-09-07 17:57         ` adaworks
2005-09-07 20:01           ` Robert A Duff
2005-09-08  8:08             ` Jacob Sparre Andersen
2005-09-07 22:46           ` Jeffrey Carter
2005-09-08  4:43             ` Simon Wright
2005-09-08 10:36               ` Georg Bauhaus
2005-09-08 13:47                 ` Ed Falis
2005-09-08 17:03                   ` Pascal Obry
2005-09-08 16:45               ` Jeffrey Carter
2005-09-08 19:37                 ` Simon Wright
2005-09-08  6:32             ` adaworks
2005-09-08  9:09               ` Jean-Pierre Rosen
2005-09-08 16:56               ` Jeffrey Carter
2005-09-09 14:04                 ` Bob Spooner
2005-09-09 16:17                 ` adaworks
2005-09-23 23:04               ` Randy Brukardt
2005-09-14  8:57           ` Ole-Hjalmar Kristensen
2005-09-23 23:09           ` Randy Brukardt
2005-09-24 10:49             ` Larry Kilgallen
2005-09-24 20:27             ` Lurker
2005-09-25  0:20             ` Robert A Duff
2005-09-25 17:05             ` adaworks
2005-09-01 11:42   ` Georg Bauhaus
2005-09-01 13:59     ` Dmitry A. Kazakov
2005-09-01 15:36       ` Georg Bauhaus
2005-09-01 18:34         ` Dmitry A. Kazakov
2005-09-02 10:43           ` Georg Bauhaus
2005-09-02 13:11             ` Dmitry A. Kazakov
2005-09-02 14:23               ` Georg Bauhaus
2005-09-02 19:48                 ` Dmitry A. Kazakov
2005-09-02 17:21           ` Björn Persson
2005-09-01 16:04   ` Robert A Duff
2005-09-01 18:06     ` Dmitry A. Kazakov
2005-09-02 10:42       ` Georg Bauhaus
2005-09-02 13:20         ` Dmitry A. Kazakov
2005-09-02 14:14           ` Georg Bauhaus
2005-09-02 19:48             ` Dmitry A. Kazakov
2005-09-03 20:01               ` Georg Bauhaus
2005-09-04 10:13                 ` Dmitry A. Kazakov
2005-09-05 13:22                   ` Georg Bauhaus
2005-09-05 15:50                     ` Dmitry A. Kazakov
2005-09-05 18:20                       ` Georg Bauhaus
2005-09-05 18:31                         ` Georg Bauhaus
2005-09-06  8:20                         ` Dmitry A. Kazakov
2005-09-06 11:52                           ` Georg Bauhaus [this message]
2005-09-06 13:46                             ` Dmitry A. Kazakov
2005-09-06 15:51                               ` Georg Bauhaus
2005-09-06 21:32                                 ` Robert A Duff
2005-09-07  9:08                                 ` Dmitry A. Kazakov
2005-09-07 18:20                                   ` Georg Bauhaus
2005-09-07 19:07                                     ` Georg Bauhaus
2005-09-07 21:23                                     ` Dmitry A. Kazakov
2005-09-08 10:27                                       ` Georg Bauhaus
2005-09-08 11:39                                         ` Georg Bauhaus
2005-09-08 13:44                                         ` Dmitry A. Kazakov
2005-09-08 18:18                                           ` Georg Bauhaus
2005-09-09 10:06                                             ` Dmitry A. Kazakov
2005-09-09 12:26                                               ` Georg Bauhaus
2005-09-09 12:29                                               ` Georg Bauhaus
2005-09-01  8:48 ` Jean-Pierre Rosen
2005-09-01 15:57 ` Robert A Duff
2005-09-01 21:42   ` Gene
2005-09-01 22:56     ` tmoran
2005-09-05 15:53       ` Gene
2005-09-05 17:47         ` jimmaureenrogers
2005-09-05 22:13           ` Robert A Duff
2005-09-06  8:24             ` Dmitry A. Kazakov
2005-09-05 19:22         ` Jeffrey R. Carter
2005-09-05 21:54           ` Robert A Duff
2005-09-05 22:50             ` Larry Kilgallen
2005-09-05 23:46               ` Robert A Duff
2005-09-12  3:59                 ` Dave Thompson
2005-09-06 16:02             ` Jeffrey Carter
2005-09-06 21:00               ` Robert A Duff
2005-09-06  5:38         ` Pascal Obry
2005-09-05 21:48       ` Robert A Duff
2005-09-06  5:25         ` tmoran
2005-09-06 14:58           ` Robert A Duff
2005-09-06  9:26         ` Georg Bauhaus
2005-09-06 15:00           ` Robert A Duff
2005-09-07 11:02             ` Thierry Pirot
2005-09-07 20:09               ` Robert A Duff
2005-09-06 13:22         ` Bob Spooner
2005-09-06 15:30           ` Robert A Duff
2005-09-06 16:12             ` Jeffrey Carter
2005-09-06 21:21               ` Robert A Duff
2005-09-02 20:19     ` Jeffrey R. Carter
2005-09-03 12:51     ` Dr. Adrian Wrigley
2005-09-03 14:08       ` Jacob Sparre Andersen
2005-09-05  8:34         ` Jean-Pierre Rosen
2005-09-05  9:32           ` Arrays indexed by fixed point types (Was: Surprise in array concatenation) Jacob Sparre Andersen
2005-09-05 11:07             ` Jean-Pierre Rosen
2005-09-05 15:12               ` Dr. Adrian Wrigley
2005-09-05 12:14             ` Dmitry A. Kazakov
2005-09-05 13:07               ` Jacob Sparre Andersen
2005-09-05 15:10                 ` Dmitry A. Kazakov
2005-09-05 11:29           ` Surprise in array concatenation Dr. Adrian Wrigley
replies disabled

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