Project

General

Profile

Bug #486

Warning about variable hiding another -- too zealous

Added by John Abbott about 10 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Parser/Interpreter
Target version:
Start date:
20 Mar 2014
Due date:
% Done:

0%

Estimated time:
20.00 h
Spent time:

Description

The warning are sometimes is needlessly alarmist:

Define F(L)
  A := [abs(L[I]+1) | I in 1..len(L)];
  I := 1;
  While A[I] < 2 Do I:=I+1 EndWhile;
  Return I;
EndDefine;  -- F

Theis produces a WARNING that the loop variable I bound inside [...] is hiding the main variable I (which is "created" only after the loop has finished).

Can we avoid these incorrect warnings?


Related issues

Related to CoCoA-5 - Support #692: Local variables hiding out ones at top levelRejected2015-05-04

History

#1 Updated by John Abbott about 10 years ago

How to determine the "scope" of a variable?
A function comprises a sequential succession of "top-level" commands; the scope is from the first sequential step where it appears onward to the end of the func.

NOTE a "sequential step" could be a loop, so the scope of a variable may start before the first occurrence in the source code.

#2 Updated by Anna Maria Bigatti almost 10 years ago

  • Target version set to CoCoA-5.1.0 Easter14

#3 Updated by John Abbott almost 10 years ago

  • Target version changed from CoCoA-5.1.0 Easter14 to CoCoA-5.1.1 Seoul14

#4 Updated by John Abbott over 9 years ago

  • Target version changed from CoCoA-5.1.1 Seoul14 to CoCoA-5.?.?
  • Estimated time set to 20.00 h

Also available in: Atom PDF