[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Matlab has implemented flip after only 10 years - deprecate flipdim
From: |
Carnë Draug |
Subject: |
Re: Matlab has implemented flip after only 10 years - deprecate flipdim |
Date: |
Tue, 23 Sep 2014 23:29:12 +0100 |
On 23 September 2014 21:46, David Bateman <address@hidden> wrote:
>
>> Le 23 sept. 2014 à 21:56, Carnë Draug <address@hidden> a écrit :
>>
>>> On 23 September 2014 17:56, Rik <address@hidden> wrote:
>>>> On 09/23/2014 04:16 AM, address@hidden wrote:
>>>> Hi
>>>>
>>>> during the codesprint this weekend (before I figured that the subject
>>>> was going to increase line coverage), I added a new function, flip,
>>>> and deprecated flipdim [1]. The function flip is exactly the same as
>>>> flipdim, the only difference being that the first exists in Matlab
>>>> (since R2014a - only 10 years after Octave).
>>>
>>> Another way to look at it is that Octave is a superset of Matlab. As long
>>> as flip is added, so that users can run their Matlab scripts in Octave, we
>>> don't necessarily have to get rid of flipdim. I actually like the name
>>> flipdim because it is more meaningful to me than just flip. Within Octave
>>> we occasionally do this where we have aliases for the same function. There
>>> is 'lgamma', the C library conventional name, and 'gammaln', the Matlab
>>> name. Both co-exist peacefully. Similarly, there is 'isbool' and
>>> 'islogical'. Maybe you want tao undeprecate flipdim and make one function
>>> an alias of the other.
>>
>> I agree with the superset of Matlab syntax but not always. I believe that
>> Matlab's default namespace (and by extension, also Octave's) is over poluted
>> so having function alias (and flip would be a flipdim alias in this
>> situation),
>> should be a careful decision. It makes sense for the examples you gave where
>> the other name is common in other places, but for flipdim I don't see why.
>>
>> I also think that the name flipdim() makes more sense but we are biased
>> because we've used it before and because we might also be thinking of
>> rotdim (I wonder how much longer it will take for Mathworks to implement it).
>>
>>
>>> On 23 September 2014 12:14, Mike Miller <address@hidden> wrote:
>>> I don't see a problem with what you've done. It's the same path we've
>>> followed before for deprecating functions, right? I don't think somehow
>>> "silently" deprecating it would have any effect, people will probably
>>> continue to use flipdim until the warning actually appears.
>>>
>>> If package maintainers want to continue to support multiple Octave
>>> versions, they can locally disable the warning wherever flipdim is used
>>> until they decide to switch to flip and depend on Octave >= 4.2.
>>
>> Usually there's a time when both functions co-exist peacefully which allows
>> for package maintainers to move on easily (I guess with the "local" option
>> to disable warnings this will be easier). Oh well, let's let it go and see
>> what happens.
>>
>> Carnë
>>
>
> For info, older versions of Matlab had the flipdim function, so this is a case
> of Matlab evolving rather than implementing something from octave.
What? This confuses me. flip and flipdim seem to do the same. Their help
text *is* different, but the only difference I see is that flip
defaults to the first
singleton dimension while flipdim requires dimension to be specified. Why
are they adding a new function to do the same thing? It must be doing something
different that I can't figure from their documentation.
Honestly, I only saw that flip was a missing new Matlab function and because
it did the same as Octave's flipdim, I just assumed that flipdim had been an
Octave only function.
> If I remember correctly rotdim is an octave extension for rot90 to NDarrays in
> the same manner as flipdim was for fliplr and flipud. So I'd say deprecating
> flipdim is the right thing to do, though the question should be posed for
> rotdim
> if Matlab implements it.
Matlab has added ND support for rot90 (and so does Octave since cset
8b2a919d24bc), but rotdim is still useful to rotate around other planes.
Carnë