Live data from Hacker News

Go Lang: Comments Are Not Directives

news.ycombinator.com

101–110 of 222 posts

Re: Go Lang: Comments Are Not Directives

#101

At last! I'm not insane! I raised this on the golang dev forums and got nowhere: https://groups.google.com/d/msg/golang-dev/r4rdPdsH1Fg/yjOOz... The response was basically "we disagree" and I wandered away feeling confused that so many bright people couldn't see the problem here.

> The response was basically "we disagree" and I wandered away feeling confused that so many bright people couldn't see the problem here. That's a rather disingenuous summary given that literally the very first response is Brad Fitzpatrick from the Go team agreeing with you, acknowledging that it's unfortunate, and admitting that it can't feasibly be changed yet due to the compatibility guarantees. And then shortly a…

I doubt that there will ever be a Go 2.

EDIT: For the downvoters, quoting Rob Pike in one of his presentations, "Go's design is done".

Re: Go Lang: Comments Are Not Directives

#102
post #76

As soon as you start using comments for something other than comments or documentation, you've basically admitted the language is broken and you end up becoming Java.

Funny that you mention it, but Rust also checks all code in comments/documentation for validity, and runs test on your comments and catches if any of them fails to compile/return appropriate result.

Re: Go Lang: Comments Are Not Directives

#103

The problem with Go is that, while the language and compiler are excellent, Google doesn't a lot care about tooling & ecosystem. Why? They have their own in-house tooling (which is of course both highly specific to Google's use case and closed of for the public). This in itself isn't bad, but the problem it causes is that the Googlers (who do not experience the pain that other users of the language do) are still the…

    The problem with Go is that, while the language and 
    compiler are excellent, Google doesn't a lot care about 
    tooling & ecosystem. Why? They have their own in-house 
    tooling (which is of course both highly specific to 
    Google's use case and closed of for the public).
This is the most bizarre criticism of go I have ever heard. Go has the best tooling of any language I have ever used bar none. A cursory look at: https://godoc.org/golang.org/x/tools/cmd shows a list of tools I've been wanting in Java and C# for years and they practically come out of the box for go.

* Automated refactoring that is editor agnostic? check.

* Editor agnostic built in documentation tool/server? check.

* Editor agnostic Code analyzers/oracles? check.

Go's core dev team is many things but saying they don't care about tooling and ecosystem is a gross misrepresentation. They may not care about your specific IDE or preferred language design but they most definitely care about making tooling available to everyone regardless of IDE/editor choice.

Re: Go Lang: Comments Are Not Directives

#105
post #57
post #14

Earlier quoted context omitted.

That's pretty bad. I think the reason why people are so upset/surprised is because they expect better from the Go team. Sometimes it really feels like they take the lazy route without putting enough thought and polish into things. Which is amplified by the previous statements regarding for example generics where they said they wont introduce them until they find a really good way to do it but then crank out half bake…

I have been using Perl for a long time, it did not get everything right when it first rolled out its object system. Through incremental improvements and backward compatibility the language has become very stable. Go is just getting to 1.5, so I expect it to have some issues at the beginning.

Agreed: Languages can evolve.

Perl has been around since 1987. I would expect Go (first released in 2009) to have learned valuable lessons from earlier failures. This particular set of features doesn't appear to be very thoughtful.

Re: Go Lang: Comments Are Not Directives

#106

In Python, following comment #- -utf8- - indicated the encoding of a source file. In most cases, this won't induce ambiguity, though it's potentially dangerous.

I was going to say it's the only one Python 2 has, AFAIK. So they've kept it reaosnable there, but then I remembered this:

https://www.python.org/dev/peps/pep-0484/#id24

Which is pretty scary, IMHO.

Python is productive, but I always questioned some of the choices in the language design (broken lambdas, etc -- though the implementation of list comprehensions were great so I just learned to love them) -- but it seems to take some of the same decisions Go is taking in terms of inconsistencies now.

The Go stuff, however, seems much more worse.

The phrase "nothing but Perl can parse Perl" comes to mind :)

Re: Go Lang: Comments Are Not Directives

#107
post #90

Meh. I hear your gripe, but I think your proposed solution is not that much of an improvement. You're also basing all of this on the idea that comments are "free form". Where is that gospel? I like the idea that comments are more than just blabber. I like the idea that, when structured some way, they take on new meanings. I think this is a semantic argument.

I too like the idea that comments are more than blabber. I do use comments like //BUG: //TODO: and //HOT:

My argument is semantic? Yes it is! In my optinion thats the reason my argument is so strong.

Please dont tell me you dont see a problem between //go: foor and //todo: bar - the first instructing some tool to change stuff in your build, the later merly mention that there is something left to do here.

A directive like #todo: bar - is a great example for a great tool in the chain. the go tool could look for a "todo" command and this todo command could print out a warning that the code should not be released because XX todos arn't done. If the go tool would'nt find a "todo" command it could warn me that a tool in the chain is missing. I could evaluate in decide to use get this tool, or choose to ignore it.

This would be imposible if comments are missused as directives!

Re: Go Lang: Comments Are Not Directives

#108
post #71
post #53

Earlier quoted context omitted.

I would define a directive as an instruction to the tool chain. A macro processor could be one of those tools in the chain. There could be other (and Go implements other use cases!) I would also argue that a macro preprocessor do'snt need to "parse comments", it could parse any syntax the preprocessor wants to (and remove it from source befor the compiler sees it) In fact my point is, that parsing comments at all is…

Okay, now I get it. Thanks for clearing that up. I have to agree that adding features into comments instead of new language blocks or frameworks is smelly.

thank you, for beeing open to be convinced :)

Re: Go Lang: Comments Are Not Directives

#109
post #107
post #90

Meh. I hear your gripe, but I think your proposed solution is not that much of an improvement. You're also basing all of this on the idea that comments are "free form". Where is that gospel? I like the idea that comments are more than just blabber. I like the idea that, when structured some way, they take on new meanings. I think this is a semantic argument.

I too like the idea that comments are more than blabber. I do use comments like //BUG: //TODO: and //HOT: My argument is semantic? Yes it is! In my optinion thats the reason my argument is so strong. Please dont tell me you dont see a problem between //go: foor and //todo: bar - the first instructing some tool to change stuff in your build, the later merly mention that there is something left to do here. A directive…

Now argue against yourself and prove you understand why you hit resistance.

Re: Go Lang: Comments Are Not Directives

#110
post #33

Earlier quoted context omitted.

Most interesting response from Russ Cox: "Where you see a hack I see an elegant design." Elegant design...

They say that beauty is in the eye of the beholder. meh.

Yeah. It makes no sense to believe that beauty is completely subjective, yet somehow related to software quality.
Post reply on HN