Skip to content

[Bug]: Using an integer variable with $ does not produce an error #1082

Description

@an3ss

Contact Details

No response

Compiler version

v1.18.7

What happened?

I've started porting a game to Boriel Basic assuming (wrongly) that K and K$ would refer to different variables. It seems not to be the case, which is fine, so I've given K$ another name. But now if I use K$ by mistake in the code, it still refers to K, which I've declared as UByte! Shouldn't this trigger an error?

Here's an example:

DIM K AS UByte
K=1
K$=2            'the compiler does not complain!
PRINT K;"/";K$  'prints 2/2

A solution may be to consider the '$' a part of the variable's itentifier, so K and K$ would indeed be different variables, as in Sinclair Basic.

Error and Warning messages

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

Fields

No fields configured for Bug.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions