Cor 0.3.0 released
yosbelms.github.io
Cor 0.3.0 released
1–10 of 10 posts
Re: Cor 0.3.0 released
#2Re: Cor 0.3.0 released
#3Sadly, it's the same mistake that CoffeeScript made: you cannot just introduce a variable, to be completely sure you didn't break anything, you'll have to search for all uses of it in outer scope above and inner scopes below.
Re: Cor 0.3.0 released
#4Cor does not has a keyword to declare variables, instead, Cor declares it for you the first time it is used. If a variable with equal name is declared in outer scope the compiler will assume you are using the declared outside. Unless you write the variable as a simple statement. This technique is called variable announcing. Sadly, it's the same mistake that CoffeeScript made: you cannot just introduce a variable, to…
http://yosbelms.github.io/cor/docs/playground/index.html#lin...
Re: Cor 0.3.0 released
#5Cor does not has a keyword to declare variables, instead, Cor declares it for you the first time it is used. If a variable with equal name is declared in outer scope the compiler will assume you are using the declared outside. Unless you write the variable as a simple statement. This technique is called variable announcing. Sadly, it's the same mistake that CoffeeScript made: you cannot just introduce a variable, to…
"Variable announcing" solves that issue, please see the example in the following link: http://yosbelms.github.io/cor/docs/playground/index.html#lin...
Re: Cor 0.3.0 released
#6Earlier quoted context omitted.
"Variable announcing" solves that issue, please see the example in the following link: http://yosbelms.github.io/cor/docs/playground/index.html#lin...
I understand that you can announce variable, but to be save, you'll have to announce it in every scope you want to declare it, so why not just use "var" or ":=" to declare and assign?
1- `var` keyword. Like javascript. It assumes all variables are global if not declared with `var`. 2- `global` keyword. Like PHP. It assumes all variables are local unlike that is annotated with `global`. 3- Ruby-like, Coffeescript-like.
A mixing of options number 1 and 3 was chosen.
I will open an issue regarding this subject, considering your proposal for future versions.
Re: Cor 0.3.0 released
#7Earlier quoted context omitted.
I understand that you can announce variable, but to be save, you'll have to announce it in every scope you want to declare it, so why not just use "var" or ":=" to declare and assign?
Looking for simplicity. One of the goals of Cor is to have few keywords, to make it easy to learn, to get involved, and to work with. I had three possible solutions to solve the variable scoping problem. 1- `var` keyword. Like javascript. It assumes all variables are global if not declared with `var`. 2- `global` keyword. Like PHP. It assumes all variables are local unlike that is annotated with `global`. 3- Ruby-lik…
someVar := 123 //declared and assigned
someVar = 456 // reassigned
anotherVar = 777 // error: undeclared variableRe: Cor 0.3.0 released
#8Re: Cor 0.3.0 released
#9Re: Cor 0.3.0 released
#10Not sure I really see the point of this. The syntax seems to offer little beyond what's possible already in ES6, and is missing several features, such as generators, destructuring, rest and spread operators and template strings that are very useful in modern JS development.