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-Thread: a07f3367d7,73cb216d191f0fef X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.92.202 with SMTP id co10mr1287797wib.1.1364344097598; Tue, 26 Mar 2013 17:28:17 -0700 (PDT) MIME-Version: 1.0 Path: p18ni19760wiv.0!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsgate.cuhk.edu.hk!goblin2!goblin.stu.neva.ru!newsfeed.x-privat.org!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not Date: Tue, 19 Mar 2013 16:19:54 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <51408e81$0$6577$9b4e6d93@newsspool3.arcor-online.net> <11rcs3gg4taww$.bylek8fsshyz$.dlg@40tude.net> <99929f93-b80f-47c3-8a37-c81002733754@googlegroups.com> <87ec4b1d-f7cd-49a4-8cff-d44aeb76a1ad@googlegroups.com> <78103a2f-5d19-4378-b211-1917175d5694@googlegroups.com> <3p6p8k0yfly7.ctazdw7fc5so$.dlg@40tude.net> <1jtvzi1v65aqm.1k5ejsveno59f.dlg@40tude.net> <1hvv2kd9smnfx.6spgz9thd1mh$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1363727999 9488 69.95.181.76 (19 Mar 2013 21:19:59 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 19 Mar 2013 21:19:59 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-03-19T16:19:54-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:vo941i7imo8t$.1jjjox9r1hkqa.dlg@40tude.net... > On Mon, 18 Mar 2013 18:13:39 -0500, Randy Brukardt wrote: > >> "Dmitry A. Kazakov" wrote in message >> news:1hvv2kd9smnfx.6spgz9thd1mh$.dlg@40tude.net... >> ... >>>> That might be less of a problem than you might think; the 'Read and >>>> 'Write >>>> should handle the Octet-view while the type as-defined handles the >>>> Array-of-[[Wide_]Wide_]Character view. >>> >>>That would make string tagged, which in turn would imply certain >>>representation [embedded tag] and forced by-reference semantics. The >>>consequences are far reaching, e.g. you would have to drop slices etc. >> >> For string, requiring by-reference would have little practical effect, as >> almost all compilers pass strings by-reference anyway. There is no >> OOP-way >> to make slicing work, since slices are by definition references (in >> C-terms, >> they're an l-value), and since the representations have to vary, that >> isn't >> going to be possible. > > It is well possible. Consider tag a constraint as array bounds are. Allow > constraints (=discriminants) passed independently as compilers already do > for array bounds. This gives you array interfaces while keeping arrays as > they are, plain arrays. No, it's not possible. In order to solve the string problem, we have to decouple the representation and the interface. But for slices, you have to know the representation in order to be able to pass it meaningfully. Moreover, the representation is not necessarily an array (UTF-8 encoding is not a normal array if you are using the character interface). So by-reference passing of part of something that is not necessarily a contiguous array is not possible. (In addition, such an interface ought to support chunked representations and the like, and again that cannot pass just a part.) >> My rough proposed Root_String_Type would be an abstract tagged type, > > I definitely don't want strings tagged. Then forget it. All composite types ought to be tagged; the root of the existing problem is that arrays aren't tagged. >> but it >> wouldn't provide slices directly (it would provide functions for that >> purpose). But that's OK, because such a construct would have to be >> alongside >> the existing string types; we can't replace or change them in any >> significant way and I think that means we'll have to start over. > > But we can. The point is that the existing type system of Ada is fully > compatible with the system I am talking about. There is no compatibility > issues. You're dreaming - it's not possible. As soon as you change the inheritance rules (which you have to do), you'll break the semantics of derived types (they'll inherit different operations). The only alternative to that is to invent a totally new kind of type declaration that pretty similar to derived types -- and that will never fly as it would be too confusing to users. >> So we're mostly talking about scalar type 'Class (we >> don't need any more anonymous access types of any kind, and they're >> essentially structural equivalence as it is, so 'Class would buy very >> little >> there). > > No, this is a huge difference. Especially for scalar types we need clear > interfaces because otherwise programs get infested by a combinatorial > explosion of generic instances. I don't follow. I said we need 'Class for scalar types (but not access types), and you said no, we need 'Class for scalar types. I don't think we need 'Class for access types, because the effect is essentially the same as what we already have for anonymous access types (the only real change needed would be to give those kinds of access types an optional name). I could imagine some disagreement on this latter point, but not on the first one. > Presently, I am unable to compile my project under any 32-bit system > because GNAT compiler needs 3GB an more to instantiate all generics, apart > from that this takes 3-4 hours on an i7, and the project has hundreds of > meaningless packages which only purpose is to instantiate. For someone that hates generics, why would you have so many? My programs are almost generic-free, most of the ones I have are one-offs like iterators and binary data readers (like Sequential_IO). The few times I've goine further, I've regretted it. Maybe you're trying too hard to be Object-Oriented; I find that is almost never worth the effort -- just build a good ADT and make it tagged and controlled so that the next person can extend it if they have to. (But hopefully they won't have to.) Randy.