comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: Proposed change to BC iterator parameters
Date: Sun, 21 Dec 2003 13:13:05 -0500
Date: 2003-12-21T13:13:05-05:00	[thread overview]
Message-ID: <DuGdnalxVMwsf3ii4p2dnA@comcast.com> (raw)
In-Reply-To: <x7vbrq2qu0z.fsf@smaug.pushface.org>

Simon Wright wrote:

> "Robert I. Eachus" <rieachus@comcast.net> writes:
> 
> 
>>Currently I often provide tools in my data structures packages to
>>provide everything viewed as an array.
> 
> 
> Brilliant! now why didn't I think of that!

Because you don't think like I do?  "The reasonable man adapts himself 
to the world; the unreasonable one persists in trying to adapt the world 
to himself. Therefore all progress depends on  the unreasonable man."
-George Bernard Shaw   Also: "Some men see things as they are and say 
why? I dream things that never were and say 'Why not?'" -George Bernard 
Shaw  and "To achieve the impossible, one must think the absurd; to look 
where everyone else has looked, but to see what no one else has seen." 
-Anon?

I've been told since I was about 3 or 4 years old that I was a genius. 
But I have never felt like I was smart.  I just wasn't quite as stupid 
as most people.  But in this case, and in many similar cases, what 
happened was I approached the problem as a language designer rather than 
as a language user.  I knew what I wanted to say, and if the language 
wouldn't let me say it, I would have argued for a change in the language.

But for years I tried to figure out why people thought iterators were so 
important.  At first I thought they were needed in tasking situations 
where a definite loop was not the right solution.  But then I realized 
that for most tasking situations what you want is to view things as a 
linked list--even if the actual data structure is say a priority queue:

loop
   declare
     Temp: Foo_Element_Type := Next(Foo);
   begin
     Process(Temp);
   exception
     when others => ...;
   end;
end loop;

Is a very common data structure.  But when you use the idiom, the AST 
can be a queue, a list, a bag, a stack, or a heap.  All you need is a 
next operation that removes the appropriate object from the structure 
and returns it.  (For some element types you don't need the declare 
portion of the block, and for others you don't need the handler part, 
but this is the full pattern.)  So I started putting Next operations in 
my data structure packages as well, and I still have never found a need 
for all the overhead of an iterator.  If anyone knows of a pattern that 
requires all the overhead of an iterator instead of the array snapshot 
or the Next function, I'd like to know about it.  (Of course, you also 
need the standard operations for the data structure, but these two 
patterns seem to be independent of the actual data structure.)

Incidently, I probably need to include this information in the 
discussion of functions returning limited types...

-- 
                                           Robert I. Eachus

"The war on terror is a different kind of war, waged capture by capture, 
cell by cell, and victory by victory. Our security is assured by our 
perseverance and by our sure belief in the success of liberty." -- 
George W. Bush




  reply	other threads:[~2003-12-21 18:13 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-10 13:36 Proposed change to BC iterator parameters amado.alves
2003-12-10 16:47 ` Proposed change to BC iterator parameters [limitedness] Georg Bauhaus
2003-12-10 17:39 ` Proposed change to BC iterator parameters Martin Krischik
2003-12-10 18:22 ` Jeffrey Carter
2003-12-10 23:00   ` Robert A Duff
2003-12-11  1:00     ` Jeffrey Carter
2003-12-11 15:09       ` Robert A Duff
2003-12-11  8:33     ` Dmitry A. Kazakov
2003-12-10 20:50 ` Simon Wright
2003-12-10 23:12 ` Robert A Duff
2003-12-11  5:07   ` Steve
2003-12-11 15:24     ` Robert A Duff
2003-12-11 17:39       ` Jeffrey Carter
2003-12-12 22:22         ` Robert A Duff
2003-12-13  0:57           ` Jeffrey Carter
2003-12-17 20:59             ` Robert A Duff
2003-12-18 10:05               ` Dmitry A. Kazakov
2003-12-18 18:14                 ` Robert A Duff
2003-12-19 10:53                   ` Dmitry A. Kazakov
2003-12-19 16:17                     ` Georg Bauhaus
2003-12-19 17:19                       ` Dmitry A. Kazakov
2003-12-19 22:51                         ` Robert A Duff
2003-12-20 12:20                           ` Dmitry A. Kazakov
2003-12-19 22:47                       ` Robert A Duff
2003-12-20  2:11                         ` Stephen Leake
2003-12-20 19:08                         ` Robert I. Eachus
2003-12-21 11:39                           ` Simon Wright
2003-12-21 18:13                             ` Robert I. Eachus [this message]
2003-12-21 13:58                           ` Dmitry A. Kazakov
2003-12-22  1:25                             ` Robert I. Eachus
     [not found]         ` <916oa1-c93.ln1@beastie.ix.netcom.com>
2003-12-13 16:57           ` Simon Wright
2003-12-12  5:29     ` Simon Wright
2003-12-12 22:26       ` Robert A Duff
2003-12-13 16:55         ` Simon Wright
2003-12-13 17:27           ` Dmitry A. Kazakov
2003-12-13  2:44       ` Steve
  -- strict thread matches above, loose matches on Subject: below --
2003-12-23 10:40 amado.alves
2003-12-19 15:53 amado.alves
2003-12-19 23:05 ` Robert A Duff
2003-12-11 16:02 amado.alves
2003-12-11 15:05 ada_wizard
2003-12-11 16:45 ` Robert A Duff
2003-12-11 12:56 amado.alves
2003-12-17 20:25 ` Robert A Duff
2003-12-11 12:43 amado.alves
2003-12-11 12:33 amado.alves
2003-12-10 14:39 amado.alves
2003-12-10  5:46 Simon Wright
2003-12-10 18:12 ` Jeffrey Carter
2003-12-11 16:10   ` Martin Krischik
2003-12-10 20:59 ` Simon Wright
replies disabled

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