Unofficial wish list status.(Mar 2009)

Nick Sabalausky a at a.a
Sun Mar 1 11:37:31 PST 2009


"Tim M" <a at b.com> wrote in message news:op.up3qsai6jdp9fl at tim-laptop...
> On Sun, 01 Mar 2009 16:58:15 +1300, Jarrett Billingsley 
> <jarrett.billingsley at gmail.com> wrote:
>
>> On Sat, Feb 28, 2009 at 7:55 PM, Tim M <a at b.com> wrote:
>>>
>>> Who's idea was the vectorization? Seems very usefull but not sure if 
>>> really
>>> like the syntax. Wouldn't it be simpler to have unordered attribute for 
>>> all
>>> kinds loops that the compiler can use?
>>>
>>
>> D already has some simple vectorization features:
>>
>> int[] a = [1, 2, 3, 4, 5];
>> auto b = a[] + 5; // [6, 7, 8, 9, 10]
>> auto c = a + b; // [7, 9, 11, 13, 15]
>
> I have no problems with that code there.
>
> http://all-technology.com/eigenpolls/dwishlist/index.php?it=10
>
> Through out that page it shows examples of iterations where order is not 
> actually defined, the index has to modify by one but it gives the compiler 
> the ability to create a few threads and execute in parallel. Thats what I 
> was actually talking about. I would hate for that code to be valid and 
> would prefer to use the usual while, do while, for and foreach loops but 
> have an attribute to enable optimization eg:
>
>
> unordered for(i = 0; i < 10; ++i)
> {
>    //anything here is independant of the previous iterations
>    //and I dont care if compiler splits accross cpu cores
> }
>
> Anyway I still think there is of low priority over other things like cent 
> data type but it is rated rather high.

Daniel mentioned part of the problem with that. The other problem I have 
with it is that in most cases it mixes two different levels of abtraction. 
You can't look at the code and immediately see the "what" without first 
analysing the "how". If I look at that code, the *first* thing I comprehend 
should not be "make 'i' go from 0 to 10, and then do somthing with 'i'", it 
should be, "Ok, this is calculating a single particular value from an array, 
ie, min, max, sum, doesBlahBlahExist, indexOfBlahBlah, whatever", or "This 
is transforming (or outputting, or inputting) the content of a collection", 
or "combining two collections in some way" etc. That's the stuff I want to 
know, the "what". The "how" belongs elsewhere, at an entirely different 
level of abstraction. That's the whole point of having functions in the 
first place, separating that "what" from the "how", otherwise we'd all be 
writing asm. (Of course, comments can be used to explain the intended 
"what", but self-documenting code is better whenever possible.)





More information about the Digitalmars-d mailing list