SamiKalliomaki / eppabasic

A new web based basic language inspired by CoolBasic.
Other
11 stars 3 forks source link

Creating similarly named function and variables gives no error #55

Open fergusq opened 9 years ago

fergusq commented 9 years ago

It is possible to create a variable variable that is named with the exactly same name as an already existing function.

Dim Print = 0
Dim Floor = 1
Dim CanvasSize = 3

This feature should be disabled, as young, innocent children do not undestand that there is a difference between functions and variables.

expositionrabbit commented 9 years ago

The parser works correctly with variables that share names with functions, so maybe this is intended?

Dim Print = 5

Print Print
Print(Print)

Prints 5 twice. I see no reason to remove this feature unless some ambiguity is found (I'd imagine that variables holding functions might cause something like x = Print in this scenario to be ambigious?)

fergusq commented 9 years ago

I know that it works, I mean that that feature itself is unnecessary and confuses young programmers. Especially if function values are implemented as in issue #19.

henkkuli commented 9 years ago

This is currently undocumented feature. We still have to decide how to implement functions as types. One idea would be that functions are constant variables but this scheme doesn't support overloading out of the box. All ideas are welcomed.

Henrik