my ideas for array operations

Christopher Wright dhasenan at gmail.com
Sat Oct 6 05:37:21 PDT 2007


dennis luehring wrote:
> just a question:
> 
> how many of these anti-integrators would habe buildin the complex number 
>  the gc and array slicing/concatenator, mixins and the 
> default-initalizer stuff into the language?

Array slicing? Very few. I hadn't seen that syntax before using D, but 
functions to do the same have usually seemed rather clunky.

Garbage collection? Since it can be disabled or worked around, few. Most 
people enjoy the leak protection, and performance-critical stuff will be 
profiled for memory usage and use manual allocation anyway.

Mixins? Damn useful. It's a way to get the benefits of code duplication 
without the costs, if nothing else. If you don't like them, you can 
ignore them (unless you're using std.signal, mutter mutter).

> what would happen if i ask for complex number integration now (in a 
> world in which D have no support) - i think i would get the same 
> results: "its too specific", "its a library thing",... "use this 
> template code..."
> 
> is D still in language development phase?

Yes. But its target is a production language, not an academic one. If it 
were academic, it would be much more open to new features, but 
programmers have to remember most of the features in the language in 
order for them to be useful.

And as Daniel Keep said, map/reduce is a much more powerful, flexible, 
and traditional means of getting these operations. And map/reduce is 
highly parallelizable; a single good implementation can do for specific 
compiler support for a few particular operations.

> maybe i need a better place for pure language development questions - a 
> place where do i not receive programatical solutions to my "problems" 
> but an open dicussion about the pro/cons...

Well, you could fork GDC.

> and i know that language development could be like hell - D 2.0 const 
> stuff i a good example what could get wrong (not everything of it)
> 
> all the ideas im trying to talk about are not 
> we-should-have-this-in-D-in-a-week more like maybe-in-a-year-or-later

Walter's time is not yet relevant to this discussion. My time and my 
memory, as a D user, are.

And if it were Walter's time that were important, I'm sure he could 
implement something that's no more efficient than a foreach loop in 
relatively short order and add the appropriate rules to the grammar. 
Like you said, he wouldn't get to it soon, but eventually. But I doubt 
it's going to happen.

You could ask for operators to be used as functions, though -- that way 
you could write:

reduce(+, [1, 2, 3, 4]); // returns 1 + 2 + 3 + 4

That looks cool. But I doubt it's very useful.

> ciao dennis



More information about the Digitalmars-d mailing list