Why aren't Ranges Interfaces?
Jack Stouffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 26 11:37:50 PDT 2015
I have been learning D over the past three weeks and I came to
the chapter in "Programming in D" on Ranges. And I am a little
confused on the choice to make Ranges based on the methods you
have in the struct, but not use a interface. With all of the
isInputRange!R you have to write everywhere, it just seems like
it would have made a lot more sense and made everyone's jobs
easier if the different types of Ranges where just interfaces
that you could inherit from.
The only reason I can think of to not do it this way is the weird
distinction between structs and classes in D.
More information about the Digitalmars-d-learn
mailing list