Iterators.jl
Iterators.jl copied to clipboard
capitalization convention
Once upon a time (truth be told, I can't find the email thread), it was decided that lowercase iterator functions would all be eager, while the corresponding uppercase name would be an Iterator object, which is thus lazy. After this was resolved and agreed to, it was immediately ignored, so we have kind of a free-for-all going on. I still think that was a good idea. Thus, Map(f,itr) would produce a Map iterator that does mapping lazily, whereas map(f,itr) is equivalent to collect(Map(f,itr)), but can of course be more efficient. Most iterators in this package define a type for lazy iteration and then immediately define a function that just constructs the type, thus constructing a lazy iterator. Of course, for many of the iterators in this package, it isn't even sensible to evaluate them eagerly. In any case, it would be nice to have some consistent convention about eager versus lazy iterator evaluation.
Capitalization seems so subtle that I'm not surprised people ignored that rule.
Maybe we should have some other convention then. It seems like the most sensible thing at the time since we need to have an iterator type to do lazy iteration anyway and those are capitalized.
eachmap? mapitr?
lazymap? On Feb 27, 2014 11:31 AM, "John Myles White" [email protected] wrote:
eachmap? mapitr?
Reply to this email directly or view it on GitHubhttps://github.com/JuliaLang/Iterators.jl/issues/19#issuecomment-36260744 .
I personally like the capitalization convention.
Kevin
On Thursday, February 27, 2014, Jacob Quinn [email protected] wrote:
lazymap? On Feb 27, 2014 11:31 AM, "John Myles White" <[email protected]javascript:_e(%7B%7D,'cvml','[email protected]');
wrote:
eachmap? mapitr?
Reply to this email directly or view it on GitHub< https://github.com/JuliaLang/Iterators.jl/issues/19#issuecomment-36260744> .
— Reply to this email directly or view it on GitHubhttps://github.com/JuliaLang/Iterators.jl/issues/19#issuecomment-36263911 .
I'm not saying I agree, but should we close the door on, doing same later:
Nim (formerly Nimrod): http://forum.nim-lang.org/t/182
"The reality is that Nimrod is case insensitive and that's one of the best thing Nimrod has."
[they also are agnostic to CamelCase vs camel_case..]
One possibility is to have functions always return iterators when called on iterator objects, and provide a function (e.g., iter) that converts collections to iterators.