On Thu, Oct 16, 2008 at 12:43 AM, Greg Ewing
<[EMAIL PROTECTED]> wrote:
> Lisandro Dalcin wrote:
>
>> And how are you going to free the memory?
>
> I'm not, that's up to the programmer. It's just a
> more convenient way of writing a malloc.

Then I have to say that I'm -1 in such magic. What about introducing
two new pseudo-keywords cnew/cdel, and use it like this (like in C++):

MyStruct *p = cnew MyStruct(a=1,b=2)
# use p
cdel p # also sets p to NULL
assert p==NULL
cdel p # success, but do nothing?

Such approach would make Cython/Pyrex closer to C++ behavior.
Moreover, this could be extended to support funny features, like
letting user choose the alloc/dealloc routines and perhaps
constructor/destructor routines.

What do you think?


-- 
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