comp.lang.ada
 help / color / mirror / Atom feed
From: briot.emmanuel@gmail.com
Subject: Re: A few questions
Date: Sat, 14 Nov 2015 11:57:07 -0800 (PST)
Date: 2015-11-14T11:57:07-08:00	[thread overview]
Message-ID: <5007b311-5d2e-448c-b8c8-fc2e2d88ea5e@googlegroups.com> (raw)
In-Reply-To: <n257bf$h6b$1@loke.gir.dk>

> No, you couldn't, because there still is no way for the compiler to identify 
> the container to pass to the Reference aspect.

You seem to be mixing the particular implementation you would use with
what the standard should allow. There is nothing in the spec of a reference
type that mandates knowing the container (and the way it currently is done
in the implementations is to use a 'Unrestricted_Access, which is ugly to
say the least).

> If you mean to magically extract it from the call to Depth_First_Search, I 
> would be strongly against as there is no need for an actual container object 
> for an iterator (and the model specifically was designed to allow that 
> possibility). It would be *much* more limiting to assume a container.

If I want my iterator to implement depth_first_search, it would indeed need to
know the container (like most iterators would need to know the container,
in fact). The reference type itself (the end product of the iteration) doesn't
need to know that though. The container is necessary for the iteration or
traversal of itself, but certainly not once you manipulate an element.

My example assumed nothing.

The implementation you seem to have in your head seems indeed to assume
a lot of unnecessary things.


> Definitely a lot more complicated than what we have (and what we have is too 
> complicated).

What we have is both too complicated and too limited. Too complicated because
nobody that hasn't spent a full week will be able to explain how the aspects
combine with iterators to end up with cursors and the for-of loop. They just
happen to work for existing containers, but as this thread has proven, anyone
who tries to actually implement them for other uses that the few official
containers quickly hits sever limitations.


> 
> >    for E of G.Breadth_First_Search loop   --  breadth first search, get 
> > element
> >        null;
> >    end loop;
> 
> Again, how does the compiler know that G is the container in this iterator? 
> "G.Breadth_First_Search" is just a function call. On top of which, you now 
> have two different and unrelated expected types for the iterator, which 
> would be a new concept in Ada.

It is a function call that returns the iterator. So obviously it is allowed to have
a relationship between the return value and the parameters. The iterator
is therefore allowed (but not mandated, that would depend on the actual
container we are talking about) to have a reference to the container.
This is called flexibility. Something lacking in the current standard.

I do not understand your last sentence about the two unexpected types.

> Making a language "more expressive" is code for "easier to write", which 
> never was a goal of Ada.

That's one of the issue here. The goal for Ada, as I understand it, has always
been to be "easier to read". There is no reason why "easier to write" should
be in opposition to that goal.

> > I like to clearly
> > state what I mean in the code, but on the other hand why should I have
> > to specify "Element (C)" when I can just use "E" ?
> 
> Readability, of course. I don't believe that you should ever have been 
> allowed to just specify E. I lost that argument 'cause it wasn't 
> sufficiently evil to waste scarce political capital on, but I don't see any 

Now I understand. You are re-fighting a fight you lost apparently. But from
talking to all my colleagues (all of whom are of course Ada experts), we all
much prefer the form with just "E" in practice. So that change was a great
improvement in the standard, if not quite wide reaching enough.

  reply	other threads:[~2015-11-14 19:57 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-31 20:29 A few questions Laurent
2015-10-31 20:49 ` Dmitry A. Kazakov
2015-11-01 13:16   ` Laurent
2015-11-01  0:25 ` Jeffrey R. Carter
2015-11-01 13:30   ` Laurent
2015-11-03  6:25   ` Randy Brukardt
2015-11-01  9:05 ` Jacob Sparre Andersen
2015-11-01 13:40   ` Laurent
2015-11-01 18:14     ` Jacob Sparre Andersen
2015-11-01 18:40       ` Laurent
2015-11-01 13:42 ` brbarkstrom
2015-11-01 13:52   ` Laurent
2015-11-01 17:59     ` Jeffrey R. Carter
2015-11-01 18:35       ` Laurent
2015-11-02 13:25     ` brbarkstrom
2015-11-01 15:15   ` Dennis Lee Bieber
2015-11-01 16:33 ` gautier_niouzes
2015-11-01 16:36   ` gautier_niouzes
2015-11-01 18:17 ` Stephen Leake
2015-11-01 18:53   ` Laurent
2015-11-02  0:41     ` Dennis Lee Bieber
2015-11-02 16:42     ` Stephen Leake
2015-11-02 17:45 ` Simon Wright
2015-11-02 18:48   ` Simon Wright
2015-11-03  6:33     ` Randy Brukardt
2015-11-03  8:26       ` Simon Wright
2015-11-03  6:40   ` Randy Brukardt
2015-11-03  8:34     ` Simon Wright
2015-11-04 16:19       ` Simon Wright
2015-11-05  1:20         ` Randy Brukardt
2015-11-05  8:34           ` briot.emmanuel
2015-11-12 18:28             ` Randy Brukardt
2015-11-12 20:19               ` Simon Wright
2015-11-12 20:56               ` Dmitry A. Kazakov
2015-11-12 21:15                 ` Randy Brukardt
2015-11-13  8:40                   ` Dmitry A. Kazakov
2015-11-13 17:52                     ` Randy Brukardt
2015-11-13 20:37                       ` Dmitry A. Kazakov
2015-11-13 22:15                         ` Randy Brukardt
2015-11-14 11:42                           ` Dmitry A. Kazakov
2015-11-14 12:37                           ` Simon Wright
2015-11-14 17:24                             ` Shark8
2015-11-14 20:09                               ` Simon Wright
2015-11-15 18:54                             ` Brad Moore
2015-11-13  8:45               ` briot.emmanuel
2015-11-13 17:41                 ` Randy Brukardt
2015-11-14 19:57                   ` briot.emmanuel [this message]
2015-11-16 19:13                     ` Randy Brukardt
2015-11-16 20:47                       ` Dmitry A. Kazakov
2015-11-17 21:30                         ` Randy Brukardt
2015-11-18  9:53                           ` Dmitry A. Kazakov
2015-11-18 22:27                             ` Randy Brukardt
2015-11-19  8:52                               ` Dmitry A. Kazakov
2015-11-19 21:15                                 ` Randy Brukardt
2015-11-16 21:50                       ` Simon Wright
2015-11-17 21:33                         ` Randy Brukardt
2015-11-17 23:14                           ` Simon Wright
2015-11-17  8:49                       ` briot.emmanuel
2015-11-17 22:09                         ` Randy Brukardt
2015-11-05  8:45           ` Simon Wright
2015-11-05  8:52             ` Simon Wright
2015-11-12 18:29               ` Randy Brukardt
2015-11-12 18:32               ` Randy Brukardt
2015-11-12 20:02                 ` Simon Wright
2015-11-12 21:08                   ` Randy Brukardt
2015-11-15 17:56                     ` Brad Moore
2015-11-15 21:42                       ` Simon Wright
2015-11-16 19:16                       ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
2015-02-07 17:43 Laurent
2015-02-07 22:15 ` Brad Moore
2015-02-08 22:37   ` Laurent
2015-02-09 13:56     ` Brad Moore
2015-02-09 18:36       ` Laurent
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox