Live data from Hacker News

Go Lang: Comments Are Not Directives

news.ycombinator.com

171–180 of 222 posts

Re: Go Lang: Comments Are Not Directives

#171

Earlier quoted context omitted.

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…

Python's list comprehensions always struck me as an odd way to go given Python's tendency to choose clarity and simplicity over complexity and expressiveness. As a Perl user, Python list comprehensions make me go cross-eyed half the time. It's something Perl specifically decided to forego as too complex and prone to causing confusion, which is saying something.

Nesting them I feel is almost always bad

blarg = [ foo(x) for x in y if x > 2]

I think is pretty decent. Helps if they are calling named functions, so it's more self documenting, depending on complexity.

Dict comprehensions can be a little brain-warping too :)

Re: Go Lang: Comments Are Not Directives

#172
post #92
post #60

Earlier quoted context omitted.

(I regularly downvote comments that are negative, and leave comments explaining why I found the comment to be negative). I actually don't think this was an unfair phrasing. I had actually felt insulted when `go generate` was announced. "You're sweeping [generics et al] under the rug using comment-bound directives and telling me it's an elegant solution to problems? Do you think I'm an idiot?" Was, in fact, very close…

Well, I get quite the opposite impression of condescending with them hanging around HN and golang nuts discussing language issues. And I'm actually fine with them making the decisions in the end. Go wouldnt be as clear and productive as it is today if every request for a feature would find it's way into the language in some half-hearted manner.

Isn't comment-driven code generation kind of the definition of a "feature request implemented in a half-hearted manner"? People asked for generics and got this. It seems like the kind of suggestion most language designers would throw out as unelegant.

If the language is so conservative as people claim, it should have neither macros/generics nor any of these pseudo-macro-generic-y half-measures.

Re: Go Lang: Comments Are Not Directives

#173

To this day, I still couldn't figure out why Go stays at the edge of being a great language, but lacks few very essential features for -to me- inexplicable reasons. Look at all the work done on JavaScript to generate code from macros and how incompatible the libraries became (JSX, sweet.js, TypeScript and so on). If there's no standardization, I'm afraid, go may have the same destiny. If anyone on the Go core team is…

A more conservative approach to macros would also just be... generics.

Re: Go Lang: Comments Are Not Directives

#174
post #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://go…

The thing that really baffles me is that Go/Google have invested so much into tooling for the language, yet didn't bother to implement official tools for the most important feature of any language: package and dependency management.

I've heard this explained as "everyone at Google just points their imports at Git repo HEADs", which is valid for a self-contained organization like that, but seems very closed-minded considering they want this language to be adopted universally.

Re: Go Lang: Comments Are Not Directives

#175

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.

It's particularly baffling when, in response to:

> But I disagree that putting commands in comments at all is a good idea. Just because other languages do it doesn't make it a good idea. It's clearly a hack to get around some historical problem, and we're better than that.

A member of the Go team says:

> Where you see a hack I see an elegant design.

It's never been an elegant design, at best, it was an acceptable design in the 90s.

Re: Go Lang: Comments Are Not Directives

#176
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.

I don't understand the conclusion. Java is certainly verbose and a fair bit aggressively ugly, but it has consistent syntax and I've never before heard anyone describe it as broken. care to amplify?

Well, not exactly comments, but Java's annotation system is an ugly kludge that should be part of the language and not an attempt at reintroducing C-style compiler directives.

The abuse they suffer under various frameworks and ORMs is one of the ugliest things I've ever seen in a language. In almost every-case they either serve little to no purpose, or would be better-off just being part of the language syntax. But now you have to learn Java, and the Java-annotation meta-system.

At least they aren't written in XML.

note I actually don't mind the Java Community's habit of usingLongNames for things, and the actual language is pretty small and nice.

Re: Go Lang: Comments Are Not Directives

#177

I also do not agree with that. This is bad for so many reasons. First, to the compiler code, comments should be discarded as soon as possible (often in the lexer). To the programmers, comments should never execute anything (this is just intuitively expected). To any go source code reader (human or machine), comments are supposed to contain only human readable text, probably a context sensitive explanation of that par…

the comment is not executed by the compiler, it's executed by the go tool

Thanks for the reply. I suppose this changes things regarding the compiler code, but it is still an external tool parsing and executing comments. There should be a better way of doing this.

Re: Go Lang: Comments Are Not Directives

#178
post #96

Earlier quoted context omitted.

Such an inflammatory troll... Do you you even know who is involved in the Go project?

That's both an appeal to wrongful authority and irrelevant. You don't judge a software product by the credentials of who wrote it, you judge it by whether it's a good software product or not.

No, it was a question.

The statement was asinine. I'm legitimately curious if the comment owner knows who is part of the core team.

Re: Go Lang: Comments Are Not Directives

#179
post #32
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 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. I think that was the case with Go from the start. Can you think of some aspect that was especially well thought-out?

I love the workspace structure and the package versions policy. Definitely my favorite among the languages I used.

Re: Go Lang: Comments Are Not Directives

#180
post #157

Earlier quoted context omitted.

You stand corrected then :) (or not). Does this comment thing make you want to flee to the safety of Java? I would put up with Java semantics if I were fulfilling a community service sentence.

Actually it would remind me on C. It did not even support a redundant comment token, and of course they did not used a comment to mark directives. go troll your self. I am always open to argue, but you have no leverage to be snarky.

Your entire tirade is a troll. You got an answer from Fitz (looked reasonable to me), but you didn't like it. So you decided to take the debate to HN?! Nothing productive ever happens like this. This is some teenage angst diarrhea. Fork the project and write your own solution. Show us all how fucking brilliant you are.
Post reply on HN