Comments (4)
@marekmaskarinec I think this is a direct consequence of the conventional scope rules. The variable i
in somefunc
is local, while in main
it is global. Does Go behave differently?
from umka-lang.
To my suprise, go behaves the same, although I think it shouldn't. Redeclaration of a variable like this:
i := 3
i := 2
causes an error like this: no new variables on left side of :=
(in go).
The case shown earlier is a redeclaration of a variable too. On the other hand, I can see some use cases to a global variable not being forced. It think, this is a good case for a warning.
from umka-lang.
Some languages like V disallow shadowing global variables with local ones, though most historically important languages, including C, allow this without a warning.
Moreover, warnings in interpreted languages are very rarely used, since they would be displayed again and again each time the user runs the program. It should be either an error or nothing.
from umka-lang.
Ok. I can see some reasons, you would want to overwrite a global variable. I was just confused.
from umka-lang.
Related Issues (20)
- expose `stdin` and `stdout` HOT 9
- Uniform error handling HOT 9
- how do I return an interface type? HOT 2
- Allow variable redeclaration from multiple return function call HOT 1
- Allow use of multiple return value calls inside of expression HOT 1
- Calling an Umka function from C HOT 3
- Accessing Umka API without linking against Umka HOT 2
- Return user-defined error codes from Umka programs HOT 1
- Parsing expressions using an operator precedence table instead of recursive descent HOT 2
- Getting an invalid key from a map will add that key to the map. HOT 2
- Enum types HOT 3
- Change qualified identifier syntax from `a.b` to `a::b` HOT 3
- Listing multiple parameters of the same type in function signatures HOT 2
- Confusing error message for incompatible types having the same name HOT 2
- Confusing error message for cyclical imports HOT 1
- The need for a bindings generator tool HOT 2
- Poor instruction sequence generation for the short-circuiting operators '&&' and '||' HOT 1
- Add `umkaAlive()`
- Infinite loop prevention HOT 4
- `scanf` doesn't support UTF-8 on Windows HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from umka-lang.