From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38c827f7e800d317 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-30 01:52:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news-feed1.de1.concert.net!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: conversion Date: Mon, 30 Jun 2003 10:52:42 +0200 Message-ID: References: <3EFCC18B.4040904@attbi.com> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1056963162 31514868 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:39923 Date: 2003-06-30T10:52:42+02:00 List-Id: On Fri, 27 Jun 2003 22:13:54 GMT, "Robert I. Eachus" 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