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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language Date: Tue, 12 Sep 2017 12:07:25 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <915874b5-52c0-4aa8-9023-82fddedb816f@googlegroups.com> <323ae5e6-f2ce-4a15-b874-906a670f331c@googlegroups.com> <35e49f52-16da-4f1a-b2e3-b8d07d736a0d@googlegroups.com> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:48044 Date: 2017-09-12T12:07:25+02:00 List-Id: On 12/09/2017 11:23, J-P. Rosen wrote: > Le 12/09/2017 à 09:15, Dmitry A. Kazakov a écrit : >> Yes, bounded-length strings have no practical use in Ada. >> >> The reason for that is that differently to other languages Ada can >> return fixed-length strings on the stack and can pass string slices down >> where a fixed-length string is expected. This eliminates most of the >> cases for bounded-length strings, the minuscule rest is handled by >> Unbounded_Strings. >> > No, because Unbounded_Strings are just one type, while bounded strings > create different types. Which was surely a design bug. If the programmer wants different types there exists a language mechanism of type cloning specifically for that purpose. > The use of bounded length is when you have various types, implemented as > strings. In a data base, you don't want an address to be the same type > as a name, even if both are represented as strings. type Name is new String; type Address is new String; > And objects have a > variable length, with a maximum set by the constraints of the > environment (usually a database). Which does not justify using bounded-length strings for interfacing the DB. No DB bindings I know deploy bounded-length strings. Furthermore using bounded-length string would bring only disadvantages when dealing with the DB. SQL parameter binding is only possible with plain flat strings. Most likely you will end up using the normal string as a middle man between the DB and the bounded-length string. And the length constraint is an arbitrary implementation detail in most cases. It is practically impossible to find a use case for bounded-length strings in Ada. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de