On Thu, 18 Jun 2009 21:00:08 -0400, bearophile wrote: > Thank you Derek Parnell for your nice summary about ranges: > with to your post my understanding of this topic has gone > from 10% to 15% :-)
LOL ... glad to have helped a tiny bit. > There are things I don't understand from what you have written: > >>OutputRange ... > In what othr situations you may use/need an OutputRange? I haven't got a clue. I'm only trying to put into simpler words what I read in the official documentation. >>ForwardRange ... > > I don't understand and I don't know what checkpointing may mean there. It's just a way to save your place in an iteration so that presumably you can come back to that spot later on. > I suggest to explain those things better, and then add 3 or more examples > (very different from each other, complete, real-world and > ready-to-be-copied-pasted-and-run, like you can find in every page of > Borland Delphi documentation) for each kind of range. And then to put > the page on the D Wiki :-) That would be nice. Hmmm... I'll see if I can do something ... >>Now I admit that these are not method names I would have choosen ... > > Andrei has shown that inventing very good names for those methods > isn't easy... Yes, he certainly has. > And putting lot of uppercase letters in the middle of those names > isn't nice, nor handy, and it's visually noisy. Eye-of-the-beholder situation. Whether one uses "getelement", "get_element", "GetElement", "Get_Element", "getElement", "GETELEMENT", "element.get", ... is beside the point. What I was trying to show was that the current names do not intuitively tell me what is the purpose of the methods. Does 'empty()' return a Boolean that tells me if the set is empty or not, or does it return an empty set, or does it cause the set to become empty, ??? A method name that consists of a single word that can be interpreted as an adjective or a verb or a noun, etc, is ambiguous, IMO. That is why in imperative languages I prefer to see method names that reduce the potential for ambiguous interpretations by using the form <verb>[<adjective>]<noun> is_empty get_front add_element get_background_color etc ... Of course, if an unambiguous name exists it should be used, and there are also abbreviations that can be employed. But anyhow, I digress as this is just a personal style issue and not worth discussing at this point. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
