On 5/15/08, Greg Ewing <[EMAIL PROTECTED]> wrote:
> Kirill Smelkov wrote:
>  So I guess I'll just have to bite the bullet and provide
>  proper const support. A pity, because it would have been
>  nice to spare Pyrex users from the tyranny of constness.

I do not agree with you here. Constness is not a tyranny for my (nor
ther are inmutable objects like tuples and strings in Python). The
real issue is that Python does not properly uses 'const' in a
consistent way.

Moreover, I believe that at Cython/Pyrex should gain support for
'const' in a primitive way, and more, generate error if the user code
try to modify const stuff. So if you do

cdef const char *p = "abc"
p[0] = 0

Cython/Pyrex complains as a C compiler would do.


When I have time, I'll try to look at all this. We should even handle
the casting from const to non-const in the C++ case with const_cast<>
instead of (type*) using macros. This is the way SWIG did it, and it
works just fine.


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to