[Scilab-users] exists yields double

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

[Scilab-users] exists yields double


Dear all,

I wonder why the function "exists" yields 1 or 0 as doubles, instead of boolean. I know there is little distinction between booleans and {0, 1} and can be easily converted back and forth. I also know that Scilab is not meant to be a strongly typed language. But wouldn't it make more sense that this kind of funtion yielded a boolean result?

It challenges reason the fact that "isreal", for instance, yields a boolean and "exists" yields a double.  

Regards,

Federico Miyara

Libre de virus. www.avast.com

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: exists yields double

Hello Federico,

Le 10/10/2019 à 06:33, Federico Miyara a écrit :

Dear all,

I wonder why the function "exists" yields 1 or 0 as doubles, instead of boolean. I know there is little distinction between booleans and {0, 1} and can be easily converted back and forth. I also know that Scilab is not meant to be a strongly typed language. But wouldn't it make more sense that this kind of funtion yielded a boolean result?

It challenges reason the fact that "isreal", for instance, yields a boolean and "exists" yields a double.


Please use isdef() instead.

exists() is a pure duplicate of isdef(), except for the output type.
Converting its output into a boolean was asked 9 years ago as bug 10892.

We should hate introducing such duplicates, that just multiply issues and confusion with strictly no added value.
This is why its removal was proposed sortly after, as bug 11000.

To me, there is no added value either to convert exist()'s output into boolean, except if this function is actually removed, or at least masked, i.e. kept only for backcompatibility reason but undocumented.

Best regards

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: exists yields double

Hi,

I completely agree with Samuel !

S.

Le 09/02/2021 à 12:27, Samuel Gougeon a écrit :
Hello Federico,

Le 10/10/2019 à 06:33, Federico Miyara a écrit :

Dear all,

I wonder why the function "exists" yields 1 or 0 as doubles, instead of boolean. I know there is little distinction between booleans and {0, 1} and can be easily converted back and forth. I also know that Scilab is not meant to be a strongly typed language. But wouldn't it make more sense that this kind of funtion yielded a boolean result?

It challenges reason the fact that "isreal", for instance, yields a boolean and "exists" yields a double.


Please use isdef() instead.

exists() is a pure duplicate of isdef(), except for the output type.
Converting its output into a boolean was asked 9 years ago as bug 10892.

We should hate introducing such duplicates, that just multiply issues and confusion with strictly no added value.
This is why its removal was proposed sortly after, as bug 11000.

To me, there is no added value either to convert exist()'s output into boolean, except if this function is actually removed, or at least masked, i.e. kept only for backcompatibility reason but undocumented.

Best regards

Samuel


_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: exists yields double

In reply to this post by Samuel GOUGEON
Le 09/02/2021 à 12:27, Samuel Gougeon a écrit :
../...

We should hate introducing such duplicates, that just multiply issues and confusion with strictly no added value.

Actually, isdef() was introduced after exist(), just about this output type: http://bugzilla.scilab.org/show_bug.cgi?id=1011#c1

IMHO, this is a good example of an insufficient discussion about arguments, when exist() was introduced.
Still, simply introducing duplicates to "fix" afterward issues, without deprecating and finally and actually removing the former syntax, or at least without undocumenting it, should be avoided as much as possible.


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

Re: exists yields double

In reply to this post by Samuel GOUGEON

Samuel,

You are right, sorry I wasn't aware of isdef().

Regards,

Federico

On 09/02/2021 08:27, Samuel Gougeon wrote:
Hello Federico,

Le 10/10/2019 à 06:33, Federico Miyara a écrit :

Dear all,

I wonder why the function "exists" yields 1 or 0 as doubles, instead of boolean. I know there is little distinction between booleans and {0, 1} and can be easily converted back and forth. I also know that Scilab is not meant to be a strongly typed language. But wouldn't it make more sense that this kind of funtion yielded a boolean result?

It challenges reason the fact that "isreal", for instance, yields a boolean and "exists" yields a double.


Please use isdef() instead.

exists() is a pure duplicate of isdef(), except for the output type.
Converting its output into a boolean was asked 9 years ago as bug 10892.

We should hate introducing such duplicates, that just multiply issues and confusion with strictly no added value.
This is why its removal was proposed sortly after, as bug 11000.

To me, there is no added value either to convert exist()'s output into boolean, except if this function is actually removed, or at least masked, i.e. kept only for backcompatibility reason but undocumented.

Best regards

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


Libre de virus. www.avast.com

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users