On Saturday 24 July 2010 06:36:34 Justin Johansson wrote: > It sounds like the D PL has invented the range idiom unlike any other PL. > > Since the dawn of PL's, which must be about 50 years now since Lisp > for example, it is hard to imagine a new PL inventing a completely > new idiom as "ranges" seem to purport. Given the many academic > arguments for ranges as opposed to iterators, why is it that the > D PL seems to be the major if not only sponsor of the range idiom? > > Is D really taking the lead here and is it likely that other PL's > will eventually take D's lead? > > Cheers > Justin Johansson
Part of it probably comes from how limitedly most languages use iterators. Most languages only use them for iteration and perhaps to aid in insertion or erasure from a container. They don't generally pass them around for algorithms and such. C++ and D are the only ones that I'm aware of which have done so. There are, of course, problems with using iterators in that fashion. Java's and C#'s solution was to put it on the list of C++ features that they didn't use and didn't make them powerful enough to really be used in algorithms. With D, it was decided to keep that power, and ranges were the solution to the problems with C++ iterators. Regardless, there are a number of ideas floating out there which never make their way into a programming language - particularly serious and well-used programming languages. That doesn't necessarily mean that they're bad ideas, but the creators of the major programming languages either weren't aware of them, didn't like them for some reason, or couldn't fit them into their language for one reason or another. It doesn't help that programming languages aren't really invented all that often - or at least it's not all that often that new ones come along which actually become heavily used. Also, most languages which are heavily used are 10+ years old if not 20+, so many newer ideas came along too late to be incorporated into most of the major programming languages or their stdandard libraries and philosophies. As far as I can tell, ranges have not been a big thing in any way shape or form. Andrei didn't invent them, but he appears to be the first to put them into major use - at least in a manner that would get other programmers to use them rather than them just being used for a particular project or company. So, they don't appear to be a particularly well-known idea at this point - certainly not a heavily used one. - Jonathan M Davis