octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: liboctave capacity, length, nemel, and numel


From: John W. Eaton
Subject: Re: liboctave capacity, length, nemel, and numel
Date: Thu, 21 May 2015 15:04:46 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.2.0

On 05/21/2015 01:56 PM, Carnë Draug wrote:

at the moment, we have 4 Array:: methods to get the current number of
elements.  They are capacity, length, nemel, and numel.  What's the idea
behind them?  Are subclasses supposed to overload some of them differently?
I couldn't find any documentation for that.

We recently got a bug about Array::length not behaving the same length() at
the interpreter, which I think makes sense.  Changing the behaviour of
Array::length() would be bad for backwards compatibility but maybe not
having it at all would be a good idea.

Just like we deprecate stuff at the Octave interpreter because there's other
functions that do the same thing, should we be doing the same in liboctave?

Long ago, I think there was the idea that capacity might mean something different from length if the allocated size of the underlying array was different from the current number of elements that were "in use".

I think numel was introduced just so the name could match numel from Matlab.

I don't know why nelem (number of elements) was introduced.

Since they all currently mean the same thing, I don't have a problem deprecating all but one. I guess at this point it would be best to keep numel and (eventually) remove the rest.

jwe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]