[Scilab-users] exists yields double

Samuel Gougeon sgougeon at free.fr
Tue Feb 9 12:27:27 CET 2021


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 
<http://bugzilla.scilab.org/show_bug.cgi?id=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 
<http://bugzilla.scilab.org/show_bug.cgi?id=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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20210209/12f06516/attachment.htm>


More information about the users mailing list