comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: conversion
Date: Mon, 30 Jun 2003 10:52:42 +0200
Date: 2003-06-30T10:52:42+02:00	[thread overview]
Message-ID: <bsqvfvsdi3aknqe2dji79s0ve136tt7m2g@4ax.com> (raw)
In-Reply-To: 3EFCC18B.4040904@attbi.com

On Fri, 27 Jun 2003 22:13:54 GMT, "Robert I. Eachus"
<rieachus@attbi.com> wrote:

>Alexander Kopilovitch wrote:
>
>> The chorus also tells you that in Ada you should not need those conversion
>> too often. Well, they are honest enough, they simply do not use Ada for
>> a job and in an environment where you must mix varying strings and constant
>> strings here and there, and at the same time you can't afford several weeks
>> for design for every change in specifications.
>> 
>> Ada simply understimates need of strings in non-numerical world (almost like
>> Fortran IV, that is, before Fortran 77). I'm sure that Ada people would cry
>> very loudly if there were similar situation with Integer type: imagine that
>> there is unconstrained (for value, not for storage size) type Integer, which
>> objects must be constrained (by value). Then, there are types Bounded_Integer
>> and Unbounded_Integer. Unbounded_Integer is good for general use, except that
>> you always have to write explicit conversion when you assign a literal (say,
>> 1 or 0) to an object of Unbounded_Integer type (currently Ada Integer is like
>> a Pascal string in this respect).
>
>This is silly.  The situation in Ada is exactly the same with integer 
>and string types. 

If you mean that unversal integer is something like String, then you
are probably right. But the difference is that we cannot declare
objects of universal integer. On contrary, for strings we can, but
surprisingly that type is called "Unbounded_String" and even more
surprising is that it is unrelated to String.

It is clear (isn't it) that all different string types have same
semantics and differ only in how they implement that semantics. So
they should be related. That length of a String value cannot be
changed is just a value constraint which by no means changes string
semantics.

So instead of looking for explanations which I doubt would convince
anybody, one could simply admit that, yes, String and Unbounded_String
should be better siblings, but to do it consistently would require too
many changes Ada's ADT model.

For example, what would happen if

   type Name is new Unbounded_String;

Should it produce a new String type? Surely. How should it be named?
Who knows.

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-06-30  8:52 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-27 10:51 conversion Andrew
2003-06-27 12:22 ` conversion Dmitry A. Kazakov
2003-06-27 12:37 ` conversion Stephen Leake
2003-06-27 14:26   ` conversion Bill Findlay
2003-06-27 17:04     ` conversion Georg Bauhaus
2003-07-04  0:21     ` conversion Dave Thompson
2003-06-27 13:25 ` conversion Robert I. Eachus
2003-06-27 18:42   ` conversion tmoran
2003-06-27 14:49 ` conversion Matthew Heaney
2003-06-27 17:10 ` conversion Georg Bauhaus
2003-06-27 17:13 ` conversion Alexander Kopilovitch
2003-06-27 17:34   ` conversion Preben Randhol
2003-06-27 22:10     ` conversion Alexander Kopilovitch
2003-06-28  9:46       ` conversion Preben Randhol
2003-06-27 22:13   ` conversion Robert I. Eachus
2003-06-30  8:52     ` Dmitry A. Kazakov [this message]
2003-07-03  7:03       ` conversion Robert I. Eachus
2003-07-09  7:42         ` conversion Dmitry A. Kazakov
2003-07-09 17:04           ` conversion Robert I. Eachus
2003-07-10 10:19             ` conversion Dmitry A. Kazakov
2003-07-11  1:56               ` conversion Alexander Kopilovitch
2003-07-05  2:40     ` conversion Alexander Kopilovitch
2003-07-05  6:33       ` conversion Georg Bauhaus
2003-07-05 17:06         ` conversion Alexander Kopilovitch
2003-07-06  3:53           ` conversion Robert I. Eachus
2003-07-06  5:13             ` conversion Jeffrey Carter
2003-07-06 12:45               ` conversion Chad R. Meiners
2003-07-07  1:09             ` conversion Alexander Kopilovitch
2003-07-06 20:04           ` conversion Georg Bauhaus
2003-07-07 14:55             ` conversion Stephen Leake
2003-07-07 21:36               ` conversion Alexander Kopilovitch
     [not found] <002701c33e22$8e9deaf0$0201a8c0@win>
2003-06-29 20:15 ` conversion David C. Hoos, Sr.
  -- strict thread matches above, loose matches on Subject: below --
2003-06-29  9:41 conversion Andrew
2003-07-04 10:42 ` conversion Janeit
2003-06-28  8:46 conversion Andrew
2003-06-28  9:49 ` conversion Preben Randhol
2003-06-30 14:08 ` conversion Stephen Leake
2003-06-27 17:37 conversion Andrew
2003-06-27 17:32 ` conversion Stephen Leake
2003-06-28  2:55 ` conversion Jeffrey Carter
1998-07-22  0:00 conversion Rick
1998-07-22  0:00 ` conversion Richard Toy
1998-07-22  0:00 ` conversion Corey Ashford
1998-07-22  0:00   ` conversion Corey Ashford
replies disabled

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