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: border2.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: a new language, designed for safety ! Date: Mon, 16 Jun 2014 17:53:17 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1402308235.2520.153.camel@pascal.home.net> <85ioo9yukk.fsf@stephe-leake.org> <9qednXOIGNDuLQXORVn_vwA@giganews.com> <1872904482424209024.314619laguest-archeia.com@nntp.aioe.org> <810507a4-427e-42bb-a468-e5939a4470db@googlegroups.com> <9qbfr6yf0gnb.182y1qs9eigz4$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1402955580 23546 192.74.137.71 (16 Jun 2014 21:53:00 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 16 Jun 2014 21:53:00 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:bv9vg8ECgzqL0gX/YtmnQ2ce3Y8= Xref: number.nntp.dca.giganews.com comp.lang.ada:186987 Date: 2014-06-16T17:53:17-04:00 List-Id: "Randy Brukardt" writes: > Which Ada 2012 has. Specifically, referencing container elements works just > like an array, and iteration works just like an array. Yes, Ada 2012 is a big improvement in this area. I found the Containers unusable in Ada 2005 due to syntactic overhead. Something like: ... My_Function(A(X).Y) ... was taking a dozen or more lines of code if A is a Vector instead of an array. That's been largely fixed, for clients of Vectors. It's unfortunate that writing something like Vectors requires arcane black magic involving access discriminants, though. It's also unfortunate that Vectors are inherently slow. I wrote a big program recently that made heavy use of Vectors. The Ada 2012 features were essential for readability -- Vectors would have been unusable otherwise. But Vectors was way too slow. So I wrote my own vectors package, using the same 2012 features, and then it was fine -- both readability-wise and efficiency-wise. >... Simon said he didn't > want keys created implicitly, so the explicit calls to Insert aren't a > problem. So what's missing? For Maps, user-defined aggregate notation. Look at how easy it is to create a mapping in Python, for example. But that's built in. I'd like user-defined aggregate notation for any type where it makes sense. For other types: User-defined literal notation. User-defined slices. How about "A Vector is limited if the component type is limited."? Arrays can do that, but Vectors can't. Basically, the goal should be that anything the language designer can do (e.g. for arrays), a programmer can do (e.g. for a user-defined array-like abstraction). Well, ALMOST anything -- I'm not asking for user-defined willy-nilly syntax. Try writing a "big nums" package, for example -- just like Ada's Integer, but unbounded. >...(Slices don't make sense for Maps, since the > items are not ordered.) Slices make sense for Vectors, though. - Bob