Re: Memory leak with cursors and data structures

"Franck Arnaud" <[email protected]> Thu, 14 Aug 2008 16:39:45 +0100
Newsgroups gmane.comp.lang.eiffel.gobo.devel
Message-ID <[email protected]>
> Are you going to remove "from" and "until" as well?

it goes without saying.

> How do you intend to implement {G}.do_all (where G is ARRAY, etc.)?

 do_all (a_agent: PROCEDURE[ANY, TUPLE[G]])
   do
     (lower |..| upper).do_all (agent do_one (a_agent, ?))
   end

 do_one (a_agent: PROCEDURE[ANY, TUPLE[G]; a_index: INTEGER)
   do
     a_agent.call ([item (a_index)])
   end

I feel you're going to ask how I implement INTEGER_INTERVAL.do_all, I'd
use recursion, it would help if the compiler recognises it in some way
so that the generated code does not use stack space, but it's the only
place where you need a slight implementation-level cheat.

as for loops which are open ended and not index-based, (1 |..|
Maximum_integer).do_until should be OK, and again if all else fails you
can always fallback on recursion but you shouldn't have to. I think all
loops I have written in the past few years are either straightforward
container loops or fit well within the Maximum_integer boundary.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/