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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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.181.13.179 with SMTP id ez19mr168038wid.5.1363918479479; Thu, 21 Mar 2013 19:14:39 -0700 (PDT) Path: p18ni6019wiv.0!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!border2.nntp.ams2.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!novso.com!ecngs!feeder2.ecngs.de!feeder.erje.net!eu.feeder.erje.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not Date: Sun, 17 Mar 2013 10:36:19 +0100 Organization: cbb software GmbH Message-ID: <1hvv2kd9smnfx.6spgz9thd1mh$.dlg@40tude.net> References: <513faaf7$0$6626$9b4e6d93@newsspool2.arcor-online.net> <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> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: XRUMb5xlbonTNodERpEXEw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2013-03-17T10:36:19+01:00 List-Id: On Sat, 16 Mar 2013 14:51:58 -0700 (PDT), Shark8 wrote: > I think it's rather a shame that the compile-time computation aspect of > generics is not emphasized a bit more You need no generics in order to compute something statically. Yes Ada could be much better with an ability to declare a function static or conditionally static. >> Without class-wide objects you need a set of instances for each combination of >> encoding/character/index. No better than present mess. > > I think it's not impossible to unify at least some of that -- Index, for > example, is always Positive. -- I don't disagree that stings are a > difficult subject, but that doesn't mean that there aren't some elegant > solutions that might be applied to the problem. I commented on a generic solution which would necessarily preserve the status quo that string types are unrelated. This is the key point. In order to reduce complexity we need operations like Put_Line become either class-wide or primitive [both operate on whole class]. >> >> Another problem is that string types must have more >>>> than one interface to deal with UTF-8 etc. An UTF-8 string is *both* an >>>> array of Wide_Wide_Character (= Unicode code points) and an array or >>>> sequence of Character (octets). > > 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. My wish is to allow T'Class constructed for an untagged type by adding a tag. E.g. T and T'Class would have different representations. This is again a key issue. Ada often conflates interface and representation/implementation. This must be fixed. But I am not even allowed to name subtype Positive is Integer range 1..Integer'Last; a type. What would happed if I asked to be able to provide an alternative representation for Positive? To disallow unary minus? >>> In any case; I think it worth considering not just outward/downward >>> expansion of the language, but inward/upward [unification] as well. >> >> Welcome in the club. But in order to be able to weight proposals you need a >> more or less formal framework to describe language type system. Already >> this little faces a fierce opposition. So don't expect much. > > This is likely to be true -- but I think the reward for doing so would > outweigh the costs. {Especially if we could unify strings s.t. the > [[Wide_]Wide_]Character packages are merely 'instantiations' of an > "abstract string."} It is not only strings. There are other types which are presently unrelated though share various interfaces [Ordered, Copyable, Comparable, Additive, Multiplicative, Indexed, Record etc]. The language does not allow to specify interfaces and have class-wide instances of those. I presume that back in 90's there was too much opposition to overhaul the type system. Tagged types were added to the existing types, while one should have made classes and interfaces fundamental to all types. We got an outbuilding instead of new fundament. [We must be happy that Taft managed to pressure for at least this change.] -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de