askql
askql copied to clipboard
Multiple variable declarations in the same scope do not result in an error.
🦄 .editor
// Entering editor mode (^D to finish, ^C to cancel)
let a = 3
let a = 4
a
Expected: Error - variable 'a' is already defined in this scope
Actual: Success
int ask(let('a',3),let('a',4),get('a'))
4
🦄
Same for let and const in the same scope:
🦄 .editor
// Entering editor mode (^D to finish, ^C to cancel)
let a = 3
const a = 4
a
Expected: Error - variable 'a' is already defined in this scope
Actual:
int ask(let('a',3),const('a',4),get('a'))
4
🦄
and consts:
🦄 .editor
// Entering editor mode (^D to finish, ^C to cancel)
const a = 3
const a = 4
a
Expected: Error - variable 'a' is already defined in this scope
Actual:
int ask(const('a',3),const('a',4),get('a'))
4
@czerwinskilukasz1 I'm not sure if there is issue for it, but we don't do any differentiation between const and let currently
@czerwinskilukasz1 I'm not sure if there is issue for it, but we don't do any differentiation between
constandletcurrently
I added it earlier today: "Assigning to a const does not result in an error" https://github.com/xFAANG/askql/issues/254
@czerwinskilukasz1 thanks
Hey @mhagmajer and @czerwinskilukasz1 , I'm new here and I would love to contribute. Can you guide me what I need to do to resolve this?
Hello Aditya, welcome to AskQL project!
This issue is related to AskVM (Ask Virtual Machine), which is interpreting code in AskCode and keeping track of resources (functions) and variables defined.
First, it would be good if you get familiar with the part of code you are going to work on. In this case it is how defining variables work in AskVM. The code for AskVM lives in src/askvm, while for the code which handles defining variables start looking at src/askvm/resources/core/let.ts. Try to understand how it works now and why executing let a = <value> twice does not cause an error.
@avats-dev
Let me know if you have more questions.