Should OCTAVE_DEPRECATED macro also apply OCTAVE_UNUSED?

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

Should OCTAVE_DEPRECATED macro also apply OCTAVE_UNUSED?

Rik-4
11/2/18

I checked in a changeset to deprecate the C++ function is_hghandle in favor
of ishghandle (https://hg.savannah.gnu.org/hgweb/octave/rev/fbc23950b00a). 
Where possible, it is better to have the C++ function names match the
Octave language functions so that programmers who are unfamiliar with the
core C++ code can, nevertheless, follow what the code is doing.

However, I'm now getting compilation messages that deprecated functions are
unused.  This hasn't been a problem before because the use of the
OCTAVE_DEPRECATED macro has been in .h header files, but the most recent
change takes place in a .cc file.

One possible solution is to have the OCTAVE_DEPRECATED macro also set the
attribute for unused.  Or, programmers could specifically add the
OCTAVE_UNUSED decoration to the function as well.  This works, but to my
eye seems long and klunky.  But, we also shouldn't care too much since this
code will be deleted within two versions of Octave.

OCTAVE_UNUSED OCTAVE_DEPRECATED (5.0, "use 'ishghandle' instead")

Does anyone else have an opinion on which path to take?

--Rik


Reply | Threaded
Open this post in threaded view
|

Re: Should OCTAVE_DEPRECATED macro also apply OCTAVE_UNUSED?

John W. Eaton
Administrator
On 11/02/2018 02:10 PM, Rik wrote:

> 11/2/18
>
> I checked in a changeset to deprecate the C++ function is_hghandle in favor
> of ishghandle (https://hg.savannah.gnu.org/hgweb/octave/rev/fbc23950b00a).
> Where possible, it is better to have the C++ function names match the
> Octave language functions so that programmers who are unfamiliar with the
> core C++ code can, nevertheless, follow what the code is doing.
>
> However, I'm now getting compilation messages that deprecated functions are
> unused.  This hasn't been a problem before because the use of the
> OCTAVE_DEPRECATED macro has been in .h header files, but the most recent
> change takes place in a .cc file.
>
> One possible solution is to have the OCTAVE_DEPRECATED macro also set the
> attribute for unused.  Or, programmers could specifically add the
> OCTAVE_UNUSED decoration to the function as well.  This works, but to my
> eye seems long and klunky.  But, we also shouldn't care too much since this
> code will be deleted within two versions of Octave.
>
> OCTAVE_UNUSED OCTAVE_DEPRECATED (5.0, "use 'ishghandle' instead")
>
> Does anyone else have an opinion on which path to take?

There's no need to mark a static function as deprecated since its scope
is only inside the file where it is defined.  So you can simply remove
it if it is no longer needed.

jwe


Reply | Threaded
Open this post in threaded view
|

Re: Should OCTAVE_DEPRECATED macro also apply OCTAVE_UNUSED?

Rik-4
On 11/02/2018 11:36 AM, John W. Eaton wrote:

> On 11/02/2018 02:10 PM, Rik wrote:
>> 11/2/18
>>
>> I checked in a changeset to deprecate the C++ function is_hghandle in favor
>> of ishghandle (https://hg.savannah.gnu.org/hgweb/octave/rev/fbc23950b00a).
>> Where possible, it is better to have the C++ function names match the
>> Octave language functions so that programmers who are unfamiliar with the
>> core C++ code can, nevertheless, follow what the code is doing.
>>
>> However, I'm now getting compilation messages that deprecated functions are
>> unused.  This hasn't been a problem before because the use of the
>> OCTAVE_DEPRECATED macro has been in .h header files, but the most recent
>> change takes place in a .cc file.
>>
>> One possible solution is to have the OCTAVE_DEPRECATED macro also set the
>> attribute for unused.  Or, programmers could specifically add the
>> OCTAVE_UNUSED decoration to the function as well.  This works, but to my
>> eye seems long and klunky.  But, we also shouldn't care too much since this
>> code will be deleted within two versions of Octave.
>>
>> OCTAVE_UNUSED OCTAVE_DEPRECATED (5.0, "use 'ishghandle' instead")
>>
>> Does anyone else have an opinion on which path to take?
>
> There's no need to mark a static function as deprecated since its scope
> is only inside the file where it is defined.  So you can simply remove it
> if it is no longer needed.

Good point.  I removed the unnecessary functions.

--Rik

Reply | Threaded
Open this post in threaded view
|

Build in functions (exprnd)

elmusrati
Hello,

We had a complex simulation program to assist systems’ reliability. Anyhow the code was written in Octave 4.0.2. We have observed that the same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’ undefined)!  This function generates random numbers with exponential distribution. Is it a bug or the function has been removed from the new version of Octave?

Thank you 

Mohammed Elmusrati

---------------------------------------
Mohammed Elmusrati, Full Professor
Head of Industrial Digitalization Team
Faculty of Technology
University of Vaasa
Phone: +358 50 4003763




On 2 Nov 2018, at 20:58, Rik <[hidden email]> wrote:

On 11/02/2018 11:36 AM, John W. Eaton wrote:
On 11/02/2018 02:10 PM, Rik wrote:
11/2/18

I checked in a changeset to deprecate the C++ function is_hghandle in favor
of ishghandle (https://hg.savannah.gnu.org/hgweb/octave/rev/fbc23950b00a).
Where possible, it is better to have the C++ function names match the
Octave language functions so that programmers who are unfamiliar with the
core C++ code can, nevertheless, follow what the code is doing.

However, I'm now getting compilation messages that deprecated functions are
unused.  This hasn't been a problem before because the use of the
OCTAVE_DEPRECATED macro has been in .h header files, but the most recent
change takes place in a .cc file.

One possible solution is to have the OCTAVE_DEPRECATED macro also set the
attribute for unused.  Or, programmers could specifically add the
OCTAVE_UNUSED decoration to the function as well.  This works, but to my
eye seems long and klunky.  But, we also shouldn't care too much since this
code will be deleted within two versions of Octave.

OCTAVE_UNUSED OCTAVE_DEPRECATED (5.0, "use 'ishghandle' instead")

Does anyone else have an opinion on which path to take?

There's no need to mark a static function as deprecated since its scope
is only inside the file where it is defined.  So you can simply remove it
if it is no longer needed.

Good point.  I removed the unnecessary functions.

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Doug Stewart-4


On Sun, Nov 4, 2018 at 10:16 AM Mohammed Elmusrati <[hidden email]> wrote:
Hello,

We had a complex simulation program to assist systems’ reliability. Anyhow the code was written in Octave 4.0.2. We have observed that the same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’ undefined)!  This function generates random numbers with exponential distribution. Is it a bug or the function has been removed from the new version of Octave?

Thank you 

Mohammed Elmusrati

---------------------------------------
Mohammed Elmusrati, Full Professor
Head of Industrial Digitalization Team
Faculty of Technology
University of Vaasa
Phone: +358 50 4003763



I think you will find  exprnd  in the statistics package.
I think it was moved there.

 

On 2 Nov 2018, at 20:58, Rik <[hidden email]> wrote:

On 11/02/2018 11:36 AM, John W. Eaton wrote:
On 11/02/2018 02:10 PM, Rik wrote:
11/2/18

I checked in a changeset to deprecate the C++ function is_hghandle in favor
of ishghandle (https://hg.savannah.gnu.org/hgweb/octave/rev/fbc23950b00a).
Where possible, it is better to have the C++ function names match the
Octave language functions so that programmers who are unfamiliar with the
core C++ code can, nevertheless, follow what the code is doing.

However, I'm now getting compilation messages that deprecated functions are
unused.  This hasn't been a problem before because the use of the
OCTAVE_DEPRECATED macro has been in .h header files, but the most recent
change takes place in a .cc file.

One possible solution is to have the OCTAVE_DEPRECATED macro also set the
attribute for unused.  Or, programmers could specifically add the
OCTAVE_UNUSED decoration to the function as well.  This works, but to my
eye seems long and klunky.  But, we also shouldn't care too much since this
code will be deleted within two versions of Octave.

OCTAVE_UNUSED OCTAVE_DEPRECATED (5.0, "use 'ishghandle' instead")

Does anyone else have an opinion on which path to take?

There's no need to mark a static function as deprecated since its scope
is only inside the file where it is defined.  So you can simply remove it
if it is no longer needed.

Good point.  I removed the unnecessary functions.

--Rik



--
DASCertificate for 206392

Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Michael Godfrey
In reply to this post by elmusrati


On 11/4/18 3:01 PM, Mohammed Elmusrati wrote:

> Hello,
>
> We had a complex simulation program to assist systems’ reliability.
> Anyhow the code was written in Octave 4.0.2. We have observed that the
> same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’
> undefined)!  This function generates random numbers with exponential
> distribution. Is it a bug or the function has been removed from the
> new version of Octave?
>
> Thank you
>
> Mohammed Elmusrati
Previous answer is correct. exprnd is in the statistics package:

https://octave.sourceforge.io/statistics/overview.html


Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Michael Godfrey
> On 11/4/18 3:01 PM, Mohammed Elmusrati wrote:
> Hello,
>
> We had a complex simulation program to assist systems’ reliability.
> Anyhow the code was written in Octave 4.0.2. We have observed that the
> same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’
> undefined)!  This function generates random numbers with exponential
> distribution. Is it a bug or the function has been removed from the
> new version of Octave?
>
> Thank you
>
> Mohammed Elmusrati

This got answered, but there appears to be no mention in the current
Manual about the
moves of functions to packages on sourceforge.

Should this be a bug report?

Michael


Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Rik-4
On 11/04/2018 08:58 AM, Michael D Godfrey wrote:

>> On 11/4/18 3:01 PM, Mohammed Elmusrati wrote:
>> Hello,
>>
>> We had a complex simulation program to assist systems’ reliability.
>> Anyhow the code was written in Octave 4.0.2. We have observed that the
>> same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’
>> undefined)!  This function generates random numbers with exponential
>> distribution. Is it a bug or the function has been removed from the new
>> version of Octave?
>>
>> Thank you
>>
>> Mohammed Elmusrati
>
> This got answered, but there appears to be no mention in the current
> Manual about the
> moves of functions to packages on sourceforge.

It was mentioned in the NEWS file for 4.4.

 ** The following statistical functions have been moved from core
    Octave to the statistics package available from Octave Forge.

followed by the list of functions which includes exprnd.

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Michael Godfrey


On 11/4/18 5:17 PM, Rik wrote:
On 11/04/2018 08:58 AM, Michael D Godfrey wrote:
On 11/4/18 3:01 PM, Mohammed Elmusrati wrote:
Hello,

We had a complex simulation program to assist systems’ reliability.
Anyhow the code was written in Octave 4.0.2. We have observed that the
same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’
undefined)!  This function generates random numbers with exponential
distribution. Is it a bug or the function has been removed from the new
version of Octave?

Thank you

Mohammed Elmusrati 
This got answered, but there appears to be no mention in the current
Manual about the
moves of functions to packages on sourceforge.
It was mentioned in the NEWS file for 4.4.

 ** The following statistical functions have been moved from core
    Octave to the statistics package available from Octave Forge.

followed by the list of functions which includes exprnd.

--Rik
Not everyone reads the NEWS file, or, of course, the Manual...

Michael
Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Michael Godfrey


On 11/4/18 5:33 PM, Michael D Godfrey wrote:


On 11/4/18 5:17 PM, Rik wrote:
On 11/04/2018 08:58 AM, Michael D Godfrey wrote:
On 11/4/18 3:01 PM, Mohammed Elmusrati wrote:
Hello,

We had a complex simulation program to assist systems’ reliability.
Anyhow the code was written in Octave 4.0.2. We have observed that the
same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’
undefined)!  This function generates random numbers with exponential
distribution. Is it a bug or the function has been removed from the new
version of Octave?

Thank you

Mohammed Elmusrati 
This got answered, but there appears to be no mention in the current
Manual about the
moves of functions to packages on sourceforge.
It was mentioned in the NEWS file for 4.4.

 ** The following statistical functions have been moved from core
    Octave to the statistics package available from Octave Forge.

followed by the list of functions which includes exprnd.

--Rik
Not everyone reads the NEWS file, or, of course, the Manual...

Michael
And, at least, whereis should be in the Manual...:-(
Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

elmusrati
Hello,
Thanks to you all for the fast help and clarifications. In octave usually when we write a function which is not in the core of Octave, it is mentioned in which package it is available. This is also the case when we write help funName. However, this was not the case with exprnd. Even with help we received a notification that  exprnd is undefined!

Moreover, in my opinion, it is always good to keep all basic math. functions  in the core of the Octave. The packages should be required to upload very specific set of functions.  

Best regards

Sent from my iPad

On 4 Nov 2018, at 22.31, Michael D Godfrey <[hidden email]> wrote:



On 11/4/18 5:33 PM, Michael D Godfrey wrote:


On 11/4/18 5:17 PM, Rik wrote:
On 11/04/2018 08:58 AM, Michael D Godfrey wrote:
On 11/4/18 3:01 PM, Mohammed Elmusrati wrote:
Hello,

We had a complex simulation program to assist systems’ reliability.
Anyhow the code was written in Octave 4.0.2. We have observed that the
same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’
undefined)!  This function generates random numbers with exponential
distribution. Is it a bug or the function has been removed from the new
version of Octave?

Thank you

Mohammed Elmusrati 
This got answered, but there appears to be no mention in the current
Manual about the
moves of functions to packages on sourceforge.
It was mentioned in the NEWS file for 4.4.

 ** The following statistical functions have been moved from core
    Octave to the statistics package available from Octave Forge.

followed by the list of functions which includes exprnd.

--Rik
Not everyone reads the NEWS file, or, of course, the Manual...

Michael
And, at least, whereis should be in the Manual...:-(
Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Rik-4
In reply to this post by Michael Godfrey
On 11/04/2018 09:33 AM, Michael D Godfrey wrote:


On 11/4/18 5:17 PM, Rik wrote:
On 11/04/2018 08:58 AM, Michael D Godfrey wrote:
On 11/4/18 3:01 PM, Mohammed Elmusrati wrote:
Hello,

We had a complex simulation program to assist systems’ reliability.
Anyhow the code was written in Octave 4.0.2. We have observed that the
same code does not work on Octave 4.4.1 and the reason that ( 'exprnd’
undefined)!  This function generates random numbers with exponential
distribution. Is it a bug or the function has been removed from the new
version of Octave?

Thank you

Mohammed Elmusrati 
This got answered, but there appears to be no mention in the current
Manual about the
moves of functions to packages on sourceforge.
It was mentioned in the NEWS file for 4.4.

 ** The following statistical functions have been moved from core
    Octave to the statistics package available from Octave Forge.

followed by the list of functions which includes exprnd.

--Rik
Not everyone reads the NEWS file, or, of course, the Manual...

Michael,

Can you file a bug about this?  What should have happened is that the list of functions in the statistics package was also updated in the core m-file __unimplemented__.m.  This m-file is called when someone types a word which is unrecognized by the interpreter.  There is already a test for possible keywords which belong to the statistics function.

    ## statistics
    case {"addedvarplot", "addlevels", "addTerms", "adtest", ...
          "andrewsplot", "anova1", "anova2", "anovan", "ansaribradley", ...

...
...
      txt = check_package (fcn, "statistics");

The change should be made on stable.

Cheers,
Rik
Reply | Threaded
Open this post in threaded view
|

Re: Build in functions (exprnd)

Michael Godfrey


On 11/5/18 7:19 PM, Rik wrote:
> Can you file a bug about this?
Done bug#: 54965

Michael