From: Franck A. <fr...@ne...> - 2008-08-14 14:55:01
|
> 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 :-). |