Matlab has implemented flip after only 10 years - deprecate flipdim

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Matlab has implemented flip after only 10 years - deprecate flipdim

Carnë Draug
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).

I'm kinda regretting deprecating it because package maintainers will
not have a chance to write code that works in both 4.0.X and 4.2.X
without triggering warnings or errors. I think it kinda makes sense to
deprecate flipdim in favour of flip (although it does annoy me folding
to Mathworks every time), but it maybe it could go through a phase of
semi, non-official deprecation, where it does not cause any warning,
it is only noticed on the NEWS, and only properly deprecated after 1
release.

Carnë

[1] http://hg.savannah.gnu.org/hgweb/octave/rev/995df67fc912

Reply | Threaded
Open this post in threaded view
|

Re: Matlab has implemented flip after only 10 years - deprecate flipdim

Olaf Till-2
On Tue, Sep 23, 2014 at 01:31:38AM +0100, Carnë Draug 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).
>
> I'm kinda regretting deprecating it because package maintainers will
> not have a chance to write code that works in both 4.0.X and 4.2.X
> without triggering warnings or errors.
What about checking Octave version in PKG_ADD, and making flip a
handle to flipdim in case of < 4.2.X, or even making something like
flip_package_internal a handle either to flip or flipdim, to avoid
potential name clashes with a users flip?

Olaf

--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Matlab has implemented flip after only 10 years - deprecate flipdim

Mike Miller
In reply to this post by Carnë Draug
On Tue, Sep 23, 2014 at 01:31:38 +0100, Carnë Draug 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).
>
> I'm kinda regretting deprecating it because package maintainers will
> not have a chance to write code that works in both 4.0.X and 4.2.X
> without triggering warnings or errors. I think it kinda makes sense to
> deprecate flipdim in favour of flip (although it does annoy me folding
> to Mathworks every time), but it maybe it could go through a phase of
> semi, non-official deprecation, where it does not cause any warning,
> it is only noticed on the NEWS, and only properly deprecated after 1
> release.

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.

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: Matlab has implemented flip after only 10 years - deprecate flipdim

Carnë Draug
On 23 September 2014 17:56, Rik <[hidden email]> wrote:

> On 09/23/2014 04:16 AM, [hidden email] 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 <[hidden email]> 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ë

Reply | Threaded
Open this post in threaded view
|

Re: Matlab has implemented flip after only 10 years - deprecate flipdim

David Bateman-2




> Le 23 sept. 2014 à 21:56, Carnë Draug <[hidden email]> a écrit :
>
>> On 23 September 2014 17:56, Rik <[hidden email]> wrote:
>>> On 09/23/2014 04:16 AM, [hidden email] 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 <[hidden email]> 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. 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.

D.
Reply | Threaded
Open this post in threaded view
|

Re: Matlab has implemented flip after only 10 years - deprecate flipdim

Carnë Draug
On 23 September 2014 21:46, David Bateman <[hidden email]> wrote:

>
>> Le 23 sept. 2014 à 21:56, Carnë Draug <[hidden email]> a écrit :
>>
>>> On 23 September 2014 17:56, Rik <[hidden email]> wrote:
>>>> On 09/23/2014 04:16 AM, [hidden email] 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 <[hidden email]> 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ë