Less coding

Jarrod qwerty at ytre.wq
Wed Feb 27 03:01:57 PST 2008


I like your collection of higher order functions, perhaps you can get 
them added to the core library in the future, or even better, Walter can 
build them into the language (ha).
If anything, D really needs a 'range'. Something like:
>int[] arr = [0..10]; //arr would contain the digits 0-9
That would be pretty cool, and it makes sense since it follows array 
initialization syntax, and looks similar to using an array slice.
Then with that I could experience what I think would be happiness as I 
used:
>foreach(i; [0..10]){...} 
for my loops instead of old 
>for (int i = 0; i < 10; ++i){...}
Which frankly I'm tired of doing after seeing and using other languages 
that deal with it so much better (perl, python, php, ruby, haskell, lisp, 
even visual basic)
It would also be nice to loop just a certain amount of times without 
needing the counter: 
>foreach([1..10]){...} 
A bit ugly I guess, but using foreach(1..10) brings in inconsistency..

Ahem, it seems I've sort of gone off on a tangent here. But yeah, HOP and 
functional stuff is awesome and would be nice to see being added to D, 
even if only as part of the library.



More information about the Digitalmars-d mailing list