On Tuesday, 19 February 2013 at 16:46:36 UTC, bearophile wrote:
John Colvin:

I think the right design here is to return a bool[N].
...
There is significant opposition to any simd operators that allocate. The reasoning is that they appear fast but are in actual fact slow (for most normal size vectors, the allocation would be much slower than the calculation itself).

I love the features of numpy and matlab etc. when it comes to array operations, many of which allocate implicitly, but Walter and others were quite adamant they they do not belong in D, a position I've come to agree with.

Can't D allocate that bool[N] on the stack?

Bye,
bearophile

Perhaps it could, but it would be:

a) quite counter-intuitive. An operation between two normal, heap allocated arrays generating a stack allocated array, with the scoping rules that entails?

b) very easy to cause stack overflow in a way that would be totally confusing to someone who wasn't aware of the implementation.

Reply via email to