bugGNU Octave - Bugs: bug #65085, exit variable should give error

 
 

bug #65085: exit variable should give error

Submitter:  None
Submitted:  Thu 28 Dec 2023 01:17:00 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
Status:  Wont Fix Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 8.1.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 28 Dec 2023 01:30:01 AM UTC, comment #2: 

"exit" is a function.  Like any other function, you can hide it by declaring a variable with the same name.  As a programmer, you should generally not use variable names that collide with existing functions.

Octave attempts to be Matlab-compatible so that code can be run under either interpreter.  It is valid in Matlab to declare a variable named "exit" which overrides the exit function and so Octave must do the same.

Marking as "Won't Fix".

Rik <rik5>
Group administrator
Thu 28 Dec 2023 01:25:03 AM UTC, comment #1: 

Do not make variables that shadows octave function.
This is a know matlab/octave feature. If you had, you can "clear" them to restore original functions. E.g.:

octave:1> pi
ans = 3.1416
octave:2> pi = 4
pi = 4
octave:3> pi
pi = 4
octave:4> exit = 1
exit = 1
octave:5> exit
exit = 1
octave:6> clear all
octave:7> pi
ans = 3.1416
octave:8> exit


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 28 Dec 2023 01:17:00 AM UTC, original submission:  

 Typing exit give value "exit = 1" because "exit" is variable to exit a while-loop. Finally usar mouse to exit. Should give error if uses name like exit for variable or else problem.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-28 rik5 CategoryNone Interpreter
        Item GroupNone Missed Error or Warning
        StatusNone Wont Fix
        Open/ClosedOpen Closed
        Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code