From: Colin A. <col...@go...> - 2008-08-14 15:17:35
|
Are you going to remove "from" and "until" as well? How do you intend to implement {G}.do_all (where G is ARRAY, etc.)? 2008/8/14 Franck Arnaud <fr...@ne...>: >> But I digress, this is not the place for language ideas. I should write >> a wiki page on the idea. > > Are they good ideas in the first place? Both the "file" and the "cursor" > problems can be dealt with by using the existing language constructs. > > For cursors, CONTAINER.do_all captures most cases where you used to use > cursors directly in the past, and we could add a do_until if you're > worried about having to prefix your do_all agent with a "if not stopped" > for partial traversals. It manages the cursor for you, no leak possible, > plus termination guarantee and it makes the code more amenable to > automatic code analysis. > > The legacy construct "loop" is rarely needed in day to day programming > nowadays, and when it is, it's often because the appropriate container > is missing the right agent API. > > For files, I think our files API may not have been updated yet, but you > can trivially devise an agent-based API that handles file closure > nicely, e.g. > > read_file (a_filename: STRING; a_line_processor: PROCEDURE [ANY, TUPLE > [STRING]]) > > I don't think you should add more clutter to the language when the > existing features cope with the problem very nicely. > > I think I'll go and write a wiki page on my proposal to remove "loop" > from the language :-). > > ------------------------------------------------------------------------- > 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=/ > _______________________________________________ > gobo-eiffel-develop mailing list > gob...@li... > https://lists.sourceforge.net/lists/listinfo/gobo-eiffel-develop > |