On Oct 11, 2008, at 7:31 AM, Dag Sverre Seljebotn wrote:

> Robert Bradshaw wrote:
>> On Oct 11, 2008, at 7:17 AM, Dag Sverre Seljebotn wrote:
>>
>>> Dag Sverre Seljebotn wrote:
>>>> Dag Sverre Seljebotn wrote:
>>>>
>>>>> What do I propose instead?
>>>>>   a) That the reference-counted heap-allocated array stuff in the
>>>>> wiki
>>>>> is implemented first (with a list constructor). So the thing gets
>>>>> the
>>>>> semantics of a reference counted array, constructed again each
>>>>> time it
>>>>> is assigned (very similar to a Python list).
>>>>>
>>>>>   b) That simple cases (where the pointer is never reassigned or
>>>>> copied,
>>>>> only written/read to/from by indexing) are then optimized to use
>>>>> stack
>>>>> allocation instead.
>>>>>
>>>> First and foremost the point now is to .
>>> Sorry! I meant: The point now was to argue for postponing the  
>>> decision
>>> for later and disable it in the upcoming release.
>>>
>>> I'd settle for disabling any "literal assignment" to the pointer
>>> outside
>>> of the declaration though, then I'd be back to "not worrying". (One
>>> could also disable it only inside loops, but that is too ugly and
>>> inconsistent.)
>>
>> I'm OK with only allowing it outside of declarations (and even
>> better, only to an array type), but don't know if I'll have time to
>> do that anytime soon.
>
> I don't understand? Do you mean the opposite, i.e only allowing it
> inside of declarations?

Sorry, jet lag... I meant to say disallowing it outside declarations.

> Anyway, the (final and realistic) proposal was:
>
> cdef int* a = [1, 2, 3] # ok!
>
> while
>
> cdef int* a
> a = [1, 2, 3] # not ok!
>
> At least for this release (adding features is easier than removing).
>
> This absolutely shouldn't be more than half an hour, it is just about
> throwing up a compiler error in the right transform.

Now that you put it that way, it makes it sound much easier--I love  
transformations :). But I actually realize how much more restrictive  
it is, as you can't do

cdef foo(int n, int* a):
     ...

foo(5, [1,2,3,4,5])

which I think could be very useful. So I would maybe say disallow  
array assignment except in declarations, but the above would still work.

> If you're +1 to
> this but don't have the time I could have a look during next week.  
> Have
> you decided on a timeframe for the release?

I was thinking in a week or two. I haven't tried compile Sage for a  
bit, but if that goes smoothly then I'd want an release candidate out  
soon, allowing a week for people to test.

- Robert

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

Reply via email to