Closed incognick closed 7 years ago
Hi, Great, thanks! There's plenty of ways to help out, though the Python influences have just diminished.
A big advantage of the var
keyword is that it is well-known to Go devs, who will likely be the majority of Have users. I'm not adamant on any concrete solution yet, though.
My current idea is probably similar: var
would always declare a new variable, unless marked with a keyword or some special character (and overshadowing of local variables would be forbidden).
So this would declare 2 new variables:
var x, err = SomeFunc()
This would cause a compile error:
var err error
if true {
var x, err = SomeFunc() // Overshadowing is forbidden
}
And this would re-use err
:
var err error
if true {
var x, some_keyword err = SomeFunc()
}
I have no idea what some_keyword
could be. I was also thinking about using a character instead, maybe ~
, or _
, but I find both rather ugly. But I think it would solve the overshadowing issue, though.
Yes, I read that post this morning. That's really unfortunate. I was really excited about this project as I've been really hesitant to do more with Go due to the syntax and lack of language features. Hopefully you'll reconsider. There's a reason why Python is so popular :)
I was really excited about Go when I started to read about it but found the syntax to be horrible coming from a C++ and Python background. I'm really excited to have found this project. Thank you for all your hard work! I hope I can help out.
My question here is why even have a keyword to declare a variable? What purpose does it have? If the default case is to always declare a variable (if it hasn't been declared before in the current scope), shouldn't there be a keyword to differ from the default case? (e.g. Python's "global" keyword, and no "var"). Or if you want to declare a constant variable, then you should write "const" or "let" for example.
I really like that you have Python influences in this language and hope to see more!