[Scilab-users] ?==?utf-8?q? Question on constant variables

Samuel Gougeon sgougeon at free.fr
Thu Nov 28 10:02:17 CET 2019


Le 28/11/2019 à 09:06, Antoine Monmayrant a écrit :
> Hello Frederico,
>   
>   
> Le Mercredi, Novembre 27, 2019 22:51 CET, Federico Miyara <fmiyara at fceia.unr.edu.ar> a écrit:
>   
>> Dear all,
>>
>> What is the reason why %pi, %e, %i, %f, %t are considered variables (see
>> help percent) when they are really constants?
> Maybe because the actual variables, if they are scalar, are called constants ( see  "a=1;typeof(a)" for example )!
> Confusing, he? :-).
>
>> If %pi were a variable with the only detail that it has a preassigned
>> value (while a bit dangerous, it could have been a possibility), then
>> this would be possible:
>>
>> --> %pi = 2
>>
>> However, one gets the following warning:
>>
>> Redefining permanent variable.
>>
>> This is misleading since one would think that the value has been indeed
>> changed, but entering
>>
>> --> %pi
>>
>> produces
>>
>>    %pi  =
>>
>>      3.1415927
>>
>> That's pi, not 2!
>>
>> So it would be better an error message such as
>>
>> Attempt to redefine permanent variable not allowed.
> I agree with you.


So do i. Or "Can't set a protected variable" or something similar could 
be OK as well (nothing is really permanent ... :-)


> Could you fill a bug and propose your improved error message?

Excellent suggestion.


>> Now, a similar attempt such as
>>
>> --> %f = 2
>>
>> yields a completely different message:
>>
>> Error: syntax error, unexpected =, expecting end of file


This is indeed a very surprising change specific to %T and %F, 
introduced with Scilab 6.0.0.
It is reported as bug 15029 
<http://bugzilla.scilab.org/show_bug.cgi?id=15029>.

Regards

Samuel

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


More information about the users mailing list