Why don't other programming languages have ranges?

Walter Bright newshound2 at digitalmars.com
Sun Jul 25 14:04:38 PDT 2010


Andrei Alexandrescu wrote:
> I strongly believe Walter got the STL and generic programming in 
> general. He might be fuzzy about some minor details, but he is plenty 
> good at plenty other things and always had a good listening ear for the 
> importance of genericity.

To be fair, it took me many years to get it. STL's brilliance was nearly 
completely obscured by the syntax of it, and I was thoroughly misled by that.

Bartosz Milewski once gave a fantastic talk where he showed some type 
metaprogramming in Haskell. I don't know Haskell, but the examples were one 
liners and easily understood. Then he showed the equivalent using C++ template 
metaprogramming, and it was many lines of complex syntax. Then, the brilliant 
part was he highlighted the Haskell bits that were embedded in the C++ template 
syntax. It was one of those "ahaa!" moments where suddenly it made sense.


> Third, ranges were "in the air" already at the time I formalized them. 
> Boost and Adobe had notions of "range", even though all their primitives 
> were to expose begin() and end(), so they were essentially lackeys of 
> the STL iterator abstraction. People were talking about "range" whenever 
> they discussed two iterators delimiting a portion of a container. It was 
> only a matter of time until someone said, hey, let's make range a 
> first-class abstraction.

In the early days of D, we talked about using arrays as the basis for the "D 
Template Library" rather than pointers. I can't find the thread about it, though.


More information about the Digitalmars-d mailing list