4 ms·
One problem with this is that it enforces certain styles upon the programmer. For instance, this function won't compile in go: func main() { p
by marketer 17y ago
One problem with this is that it enforces certain styles upon the programmer. For instance, this function won't compile in go:
func main()
{
println("hello world")
}
Instead, if you run gofmt -w on the above code, you get this:
func main() { println("hello world!") }
This compiles fine, but it looks ugly.
- omouse 17y agoMaybe we can treat Go like assembly language then. Made for a computer to run, not for a person to read. So we'll need a higher level language and less ugly language than Go to write Go.
- lsb 17y agoYes, but that's hardly an auspicious beginning to a language.
- dchest 17y agoAre you sure the first one doesn't compile (provided that you change println to fmt.Println, of course)? I can compile (with 6g) the hello world example from golang.org with any brace indentation style.
- marketer 17y agoMake sure you're running the latest parser code; do an 'hg sync' on the go tree. Or you can read the relevant mailing list thread: http://groups.google.com/group/golang-nuts/browse_thread/thread/9eb0c7c1f20db921 http://groups.google.com/group/golang-nuts/browse_thread/thr...
- dchest 17y agoHa-ha, you're right, thanks for the link! I think this is really bad.
- JulianMorrison 17y agofunc main() { is read as: func main(); { due to the new semicolon-inserting lexer rules. If you use the gofmt style, you won't notice this breaking change.