Project

General

Profile

Actions

Bug #14

closed

Variables named the same as procedures - Compile error

Added by Jason Wroe almost 5 years ago. Updated almost 4 years ago.

Status:
Rejected
Priority:
Low
Target version:
Start date:
01/17/2020
Due date:
% Done:

0%

Estimated time:
0:00 h
Affected version:

Description

Global HIT

Procedure HIT
End Proc

Badly named but this compiled in AMOS, compile error in "Global HIT"

Actions #1

Updated by Francois Lionet almost 5 years ago

  • Assignee set to Francois Lionet
  • Priority changed from Normal to Low
  • Target version set to 0.9.3
Actions #2

Updated by Brian Flanagan over 4 years ago

  • Status changed from New to Rejected
  • Estimated time set to 0:00 h
  • Affected version changed from 0.9.2.6 to Beta RC2

The problem is, that since a procedure can now have a return value, there is no way for the transpiler to tell what the intention of the programmer is.

Just suppose hypothetically, that it was "possible", and I had the following program:

Global HIT
HIT=3

Procedure HIT
  Print "hit"
End Proc[5]

Print HIT 

Here's where the conflict occurs. Is the result 3 or 5? There is NO way to tell.
In order to know the difference, the computer would have to read the mind of the programmer.

The only way I can see around this would be to REQUIRE an empty set of square brackets in the Procedure definition for a procedure without parameters, in order to differentiate it from the variable with the same name. I don't think we want to do that. I'd rather avoid the [] on procedures with no parameters, that to have the dubious option of having a variable and a Procedure with the same name.

Actions #3

Updated by Brian Flanagan almost 4 years ago

  • Affected version changed from Beta RC2 to 1.0.0 (B3)
Actions

Also available in: Atom PDF