RFC on range design for D2

JAnderson ask at me.com
Thu Sep 11 08:27:29 PDT 2008


Walter Bright wrote:
> bearophile wrote:
>> That idea of yours scares me a little: I believe that if you want to
>> create a language able to do *everything* better than C++ you may end
>> creating a language almost like C++. I was hoping for D to become
>> less powerful (and quite less complex) than C++. Many things in D1
>> are designed to be less powerful than C++ ones. So now I'd like to
>> know what Walter thinks about this subject (and other people),
>> because there's a large difference in what I think D wants to be and
>> what you say to me.
> 

IMHO

I think complexity is relative to the problem being tackled.  At the 
point at which something gets complex it probably requires its own 
abstraction.

Case in point, ranges.  We could create and manage ranges ourselves 
using standard C style forloops however to get it up to the level ranges 
provide we would have to add a load of asserts to validate that its 
correct.  Ranges abstract so that we don't have to think about it all 
the time.  Yes ranges are a more complex beast but only the internals, 
not the externs when your using them in a foreach.  So to begin with we 
are writing more code but its abstracting away details that you don't 
want to think about on a day-to-day bases, not to mention reuse.

Maybe D will endup with many more complex features then C++ however if 
they are used by library writers (in particular the standards) to make 
libraries easier to use then I'd say its a win.  If a feature enables us 
to optimize code just by using a few different terms then its a win.  If 
a feature reduces the complexity (size) of our own code then its a win. 
  If it reduced time spent in the debugger then its a huge win.

Looking at something like a car, these things are more complex then ever 
however its there complexity that makes them simple to use.  Personally 
when I'm coding I like to only pull as few strings as possible to get a 
job done.  It takes some time to get code in a state where that is 
possible however thats marginal compared to the time saved.

-Joel


More information about the Digitalmars-d-announce mailing list