I played Vlang playground(https://vlang.io/play), then found a bug.
Steps to reproduce:
fn main() {
u := 100
println(&u)
}
You just found a bug. V can't compile this program, but it should. Please create a GitHub issue.(My English was maybe something wrong, sorry.)
I think this program should also be compiled, but there is an error.
fn main() {
u := "100"
println(&u)
}
↓
test.v:2
unexpected token `INT`
こんにちは
fn main() {
u := 100
println(&u)
}
This has been fixed, thanks for reporting.
fn main() {
u := "100"
println(&u)
}
V uses ' for strings, I'll make it complain about using ".
V uses ' for strings, I'll make it complain about using ".
@medvednikov In V, what is the use case for using " (double quotes)?
Right now " is not supported at all. And I'm not sure I want to add double quotes, since having only one way to denote strings makes the language more consistent and simpler.
V uses ' for strings, I'll make it complain about using ".
Done.
Right now " is not supported at all. And I'm not sure I want to add double quotes, since having only one way to denote strings makes the language more consistent and simpler.
I absolutely love this idea. It's something that I love about Go. Nice. 👍
I think it’s worth having ‘ and “ for strings, because if you want to write a string with a ‘ character inside it you can use “ strings instead of using an escape character, which is arguably nicer.
I think it’s worth having ‘ and “ for strings, because if you want to write a string with a ‘ character inside it you can use “ strings instead of using an escape character, which is arguably nicer.
So wouldn't the easiest thing to do be to make double quotes the _only_ way to make strings? That way, single quotes can be easily added. If double quotes want to be added, strings can have two single quotes. Or maybe escaped double quotes.
From my own experience, double quotes are used a lot more often in strings (for example JSON).
I agree in a way, but it depends entirely on what you’re doing. For example, if you’re writing a sentence and use the word “they’re”, it will be advantageous to not have to escape that.
To be honest though, if I had to choose one, it would be double-quotes, because I tend to associate single-quotes with single characters.
@medvednikov based on new input from @zac-garby, is there any way to change V from having single quotes to using double quotes for enclosing strings?
@medvednikov
Thanks a lot!
ありがとうございました!
Most helpful comment
I agree in a way, but it depends entirely on what you’re doing. For example, if you’re writing a sentence and use the word “they’re”, it will be advantageous to not have to escape that.
To be honest though, if I had to choose one, it would be double-quotes, because I tend to associate single-quotes with single characters.