Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

capitalization convention #19

Open
StefanKarpinski opened this issue Feb 27, 2014 · 7 comments
Open

capitalization convention #19

StefanKarpinski opened this issue Feb 27, 2014 · 7 comments
Labels

Comments

@StefanKarpinski
Copy link
Contributor

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.

@johnmyleswhite
Copy link

Capitalization seems so subtle that I'm not surprised people ignored that rule.

@StefanKarpinski
Copy link
Contributor Author

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.

@johnmyleswhite
Copy link

eachmap? mapitr?

@quinnj
Copy link

quinnj commented Feb 27, 2014

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//issues/19#issuecomment-36260744
.

@kmsquire
Copy link
Member

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//issues/19#issuecomment-36263911
.

@PallHaraldsson
Copy link

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..]

@iamed2
Copy link
Collaborator

iamed2 commented Sep 26, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants