On Dec 29, 2008, at 9:46 AM, Lisandro Dalcin wrote:

> I have some working code. If any of you have some time, I can send a
> preliminary patch.

I don't know how soon I'll have time, but I'm very interested in this.

> There are a lot of issues that need to be addressed, mainly:
>
> * This new complex support should be enabled by using a complier
> directive. If not, there are backward compatibility issues, now
> 'complex' means the native C99/C++ type, and not the Python type
> object. Furthermore, what would happen if the C compiler does not
> fully implement C99 (Sun?). Other way will be to also support an
> implementation based on Python's "Py_complex" struct, but I have not
> idea how to transform airthmetic operations in appropriate function
> calls.

I think we should use our own struct, and transforming the arithmetic  
into function calls is something I've already thought about (in fact,  
this is what I intended to do, with macros being defined in the case  
the compiler supports complex types natively).

> * Regarding the above issue, I'm not sure if we should use "complex"
> or something new, like "ccomplex", I mean, how to specify the C native
> type, like "cdef complex z" or "cdef ccomplex z", or something
> different. The second will clearly help to dissambiguate and also
> solve backward compatibility issues.

I think we should handle this the same way we handle int, float,  
long, etc, i.e. the name specifies the C type.

> * Up to now, I'm only managing the "double complex" case, supporting
> "float complex" or "long double complex" will require the introduction
> of a 'precission' concept in the spirit of 'longness' for integers
> (What do you think?).

We should certainly support this.

> Unfortunately, I'll not be available on all January to further work on
> this. Just let me know if any you want to look at my patch. At least,
> it serves to figure out what parts needs to be touched to make Cython
> understand "complex" as a native C type.

I need this for something I'm working on, so I'll try and pick up  
where you left off.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to