Dag Sverre Seljebotn wrote:
> 5) But again, the numerical stuff has happened as a byproduct, I realize 
> that neither you nor Robert need it, and that Cython's real goal lies 
> elsewhere

It's less of a question of "who needs it", since there would be different
types of use cases for an array and vector type. This is about language
design, so the question is: what would users expect?

When I see a C array, I think of a memory block with a sequence of
identically typed items. I also think of a Python tuple because that
behaves very similar. I totally do not think of a math vector, because that
is a very (very!) special use case.

The examples you gave used "int" as a base type, simply because you were
thinking of numeric use cases. What about an array of pointers or structs?
What should adding two of those do?


> - There's always compiler directives

;) I actually thought about putting a mention of this with a big fat NO
into my last mail but then just stopped waiting for someone else to bring
this up.

A compiler directive would mean that

        a + b

would do entirely different things depending *not* on the types of a and b,
but on the state of the compiler. That's evil.


> - Or int[:,:,componentwise=True]

The main difference here (from a Python POV) is the implementation of
__add__ and friends, right? So the way I see it is that this should not be
an option. It's the entire *type* that should be different. If you want a
vector, use an explicit vector type. If you want a memory managed array,
use a standard array type. Don't mix the two, except after (explicit) coercion.

I haven't thought about how to cast this into a syntax yet, so this is just
my idea on how this should behave.

Stefan
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to