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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5bcc293dc5642650 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.46.193 with SMTP id x1mr16620362pbm.7.1319229365081; Fri, 21 Oct 2011 13:36:05 -0700 (PDT) Path: d5ni40787pbc.0!nntp.google.com!news2.google.com!news3.google.com!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Why no Ada.Wide_Directories? Date: Fri, 21 Oct 2011 22:36:03 +0200 Organization: Ada @ Home Message-ID: References: <9937871.172.1318575525468.JavaMail.geo-discussion-forums@prib32> <418b8140-fafb-442f-b91c-e22cc47f8adb@y22g2000pri.googlegroups.com> <7156122c-b63f-487e-ad1b-0edcc6694a7a@u10g2000prl.googlegroups.com> <409c81ab-bd54-493b-beb4-a0cca99ec306@p27g2000prp.googlegroups.com> <4d97ced2-1695-4352-926c-2070f9ccbbf1@o19g2000vbk.googlegroups.com> <1cchjqhfjqo2l$.1s951jo0p9w8c.dlg@40tude.net> <1xuiads70kb6s$.odhmr2fg9b0z.dlg@40tude.net> NNTP-Posting-Host: q7N8AolrQHo0KApF9Qa31g.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.51 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: news2.google.com comp.lang.ada:14139 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2011-10-21T22:36:03+02:00 List-Id: Le Fri, 21 Oct 2011 22:02:55 +0200, Dmitry A. Kazakov = a =C3=A9crit: > You wrote about the implementation being sufficient, which is evidentl= y > wrong. > > The interface =3D an array of code points indexed by some cardinal num= ber = > is > sufficient. The implementation =3D Wide_Wide_String is not. That's what I wanted to mean: array interface implemented with its most = = naive implementation. The interface is good and is Ada side, the = implementation may vary, and is compiler side. > Ada does not allow you multiple implementations for this interface = > forming > one class of types. Ada does not allow you constrained subtypes of the= > interface, e.g. narrower sets of code points (String), narrower ranges= of > the index (small embedded targets). Ada does not allow you alternative= > implementations like unbounded strings in the same class. That's not that easy. If you want to restrict the set of code point = allowed in a container, you must care about preserving class properties.= A = subtype T1 of a type T0, is supposed to be a valid element where a type = T0 = is expected. However, if the actual is T1 and the expected type is T0 an= d = the object is a target of some operation, then as an example, appending = a = code point outside of the restricted range, while valid with an actual o= f = type T0, would be illegal with an actual of type T1. On the contrary, as= a = source T1 will always be valid where a T0 was expected. Conclusion: the interface could not remain the same, and different = interface, means different type. Unsolvable (a common pitfall known of = ancient Eiffel users). That's by the way one of the reason why assertion= s = introduced with Ada 2012, are expected to be checked at runtime, because= = to warrant it to be statically valid, would lead to a real nightmare for= = the language maintainers (I keep in mind you don't enjoy runtime check, = = which is OK, if you assume all of the consequences). > This problem is a *fundamental* problem of the Ada type system. It mus= t = > be > addressed if the Ada wishes to stay a strongly typed language. If address nicely enough (except with some area like String and some par= t = of access types) what it provide. Consistency in a narrow range is bette= r = than a wide range with inconsistencies, and to most people, a narrow ran= ge = which can be reasonably implemented, is better than a perfect thing whic= h = cannot be implemented. That was one of the error Bertrand Meyer did, whe= n = he asserted language designers should not bother about whether of not a = = given language property is certain to be implementable. In real life, = language designers have to care it is, and have to care it is reasonably= . As said in a prior message, such languages already exist, but as far as = I = know, all I played with was either interpreted or inefficient languages = = (and all had names I cannot remember, sorry), which is not OK for Ada (f= or = me it's OK if it lacks some purity, as long as it is safe and efficient = = enough). After all, may be what you need is not Ada! (would not be a shame). > How so? They are two most used public interfaces of composite types in= = > Ada! The language does not enforce it, this only occur in the standard librar= y, = and you remain free to not follow this design and choose your own if you= = wish. Just like the naming convention, I don't enjoy the one of the = standard package, that does not prevent me from using my own,, the = language does not enforce anything there. > BTW the same applies to the numeric types, would you claim them used o= nly > privately too? Arguable in theory, not in practice. If it ever is, just use a language = = better suited for your very specific area. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [Ep= igrams on = Programming =E2=80=94 Alan J. =E2=80=94 P. Yale University] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [Idem] Java: Write once, Never revisit