7 ms·
I know this is about the weakest critique possible, but currently using Go, I know my next project won't be in it, simply for the impossibility to put an openin
by musage 9y ago
I know this is about the weakest critique possible, but currently using Go, I know my next project won't be in it, simply for the impossibility to put an opening curly brace on its own line. Other languages that don't require semicolons at the end of a line have it, and even if they didn't, I'd rather have to put semicolons manually.. Go is "opinionated" I guess, but so am I. Whatever their target audience is, I'm not in it.
One thing I used to hate about PHP but then kinda grew to like was variables being prefixed with a $, as it makes it real easy to distinguish between functions and variables at a glance.
Other than that, it's just programming. For me, who is making really simple things, 99% of the work is figuring out the pseudo-code and data structures, if the language doesn't get into my way, they're pretty much all the same. I haven't tried Rust yet, but from a casual glance I do like what I see.
- donjoe 9y ago... curly brackets on new lines do work perfectly fine in case you're writing code on your own. As soon as you start working in a team and each team member starts to use their own formatting, it becomes super messy and unreadable. Either you inforce a clear style guide which leaves you to explain the team why your style is the best, or you leave this task to the language itself and never ever have to start arguing about curly brackets, whether to use tabs vs. spaces, ... (I'll stop here).
- musage 9y agoBut why should Go enforce it on behalf of everybody? A parser option to not automatically insert semicolons would be all I need, but no. To me, even with super short lines, braces at the end of the line are messy, and consistently messy is still messy. > Either you inforce a clear style guide which leaves you to explain the team why your style is the best, or you leave this task to the language itself Which then leaves the language to explain why that style is best. Did Google ever do that?
- donjoe 9y agoGo's authors didn't explicitly explain their choice of style, yet they explain why they enforce it: https://golang.org/doc/faq#Is_there_a_Go_programming_style_guide https://golang.org/doc/faq#Is_there_a_Go_programming_style_g... https://golang.org/doc/effective_go.html#formatting https://golang.org/doc/effective_go.html#formatting Style guides are a matter of taste. None is better or worse. Yet, I really don't like discussing about my taste within a team of different tastes. It's like asking someone why he/she'd prefer black coffee over cappuccino. I'd prefer someone (or the language) making a clear decision upon code style and enforcing it rather than ending up with a messy, un-styled code base.
- thegeekpirate 9y agoOfficial response: https://www.youtube.com/watch?v=PAAkCSZUG1c&t=8m43s https://www.youtube.com/watch?v=PAAkCSZUG1c&t=8m43s
- musage 9y agoYeah, that's what I thought.
- AnimalMuppet 9y ago> To me, even with super short lines, braces at the end of the line are messy, and consistently messy is still messy. To me, they're just harder to spot. I think having them on their own line "frames" the inner block nicely. That said, brace location is not the hill I'm willing to die on. It's a minor thing, not worth getting religious over. For my own code, I'll do it how I want. For a team, though, consistency really does matter. I'll make my case, and then I'll shut up and do what the group decides. (And actually, I think consistency within a file matters more than consistency between files, so I'm fine with "The file author/main maintainer sets the style for the file. If you modify the file, keep the existing style.")
- vidarh 9y agoBut when the language/tooling enforces it, you've made language choice a proxy for style choice. A large part of what makes me stick to Ruby over Python for example, is that I can't stand languages with significant indentation. It may seem minor, but it isn't to me, to the extent where I avoid Python whenever I can. When your language enforces formatting like that, people will choose or choose away the language over the formatting. It's that important. Especially with so many languages to choose for that you can often pick one that is sufficiently similar.
- tqkxzugoaupvwqr 9y agoGo enforces a style because all code, written across different teams and organisations, should look the same so anybody can pick up anybody else’s code and read it with ease. There are no differing styles in different libraries. It’s very harmonic. What I can’t stand in other languages is the Laisser-faire attitude regarding styles. Some people put whitespace here, some there, some put the curly brace here, some there. How about some consistency across all codedbases?
- vidarh 9y agoI'm not willing to put up with harmony at the cost of the code I have to spend most of my time reading being formatted in ways I don't find optimally readable. Making people who care about formatting to the extent I do refuse to use the language is the cost of tools that enforce those kind of rules. That's of course their choice, just as it is mine to stay clear of tools (and languages) I don't consider worth my time.
- UncleEntity 9y ago> A large part of what makes me stick to Ruby over Python for example, is that I can't stand languages with significant indentation. More like 'consistent indentation' methinks. I still have nightmares about trying to merge some GSOC student's code from their branch to trunk where the indentation was all over the place, it was so bad that lint couldn't even figure out what the hell they were up to -- well, I think lint was crapping out on macros more than anything but still... So...someone got to put on their resume they did a GSOC for Blender but the work they did was basically wasted since it wasn't possible to clean it up enough to merge.
- csixty4 9y ago> One thing I used to hate about PHP but then kinda grew to like was variables being prefixed with a $, as it makes it real easy to distinguish between functions and variables at a glance. This is great for a lot of code but it's probably my biggest complaint about the language these days. PHP supports first-class functions, which is great until you realize all your functions stored in variables have $ at the front. So now, not only can't you use $ to distinguish variables from functions (because sometimes they're both) but you have to remember if something is a Closure* or not. * another minor pet peeve is that you have to explicitly tell a function what variables it can see from the surrounding scope, but all anonymous functions inherit from a class called Closure whether they can see anything outside their own scope (a closure) or not.
- WiseWeasel 9y agoOur team uses snake_case for variable names and camelCase for function names in PHP to address that ambiguity. To me, the limited scope of variables with respect to functions makes debugging and code reading much easier, since everything I need to think about within a function scope is explicitly defined.
- charlysl 9y agoIt's a shame to choose or dismiss a language based on what is an accident rather than essential, but I understand. I, for instance, are not a big fan of reading and typing Lisp/Scheme/*, pretty printing or not, even though I understand why it is the way it is, or whether its otherwise fascinating. :((((((((((
- kalekold 9y ago> I know this is about the weakest critique possible, but currently using Go, I know my next project won't be in it, simply for the impossibility to put an opening curly brace on its own line. Other languages that don't require semicolons at the end of a line have it, and even if they didn't, I'd rather have to put semicolons manually. Go actually does use semicolons and the formatting has been forced onto users to allow easier automatic insertion of them. They were going to get removed but in the end it was easier just enforcing a format. https://golang.org/doc/effective_go.html#semicolons https://golang.org/doc/effective_go.html#semicolons
- nnq 9y ago> impossibility to put an opening curly brace on its own line I sincerely wish all languages with braces would have this feature! Even Javascript devs practically standardized in always putting braces at the end of the line. I prefer working with code that mixes tabs and spaces than with the old-ancient style of spoiling a nice and clean empty line with a brace (yeah, you can just leave a line empty if you want your code to look nicer and more separated). Thank God I can do a lot of my work in Python and don't have to care about these things though. Would've been great if Go too borrowed the "indentation for code structure" amazing idea from Python ;) I mean, really, even Lisps never put their parens at the beginning of otherwise empty lines...
- tqkxzugoaupvwqr 9y agoThat Go uses curly braces instead of significant whitespace was a conscious decision. I think it was Rob Pike who talked about how he got bitten by a subtle bug in Python due to overlooked incorrect indentation. Curly braces also make it easier to paste code into the correct scope.
- owenmarshall 9y agoThis is brilliant satire because I can’t tell if it is truly satire or if it’s not. Leaning towards “satire” based on your last sentence. Let us all know if I was right.
- musage 9y agoWhy can't I have my own outlook and priorities? Why can't I like what I at a casual glance at the Rust docs? When I say casual glance, I mean casual glance, and if I missed something really horrible, I'll find it soon enough once I started actually using Rust; but I'm not going to feel silly for something you can't even be bothered to point out. People actually sit there and say not even having the option saves them discussions, and that's not satire? I program entirely for my own utility and artsy experimental purposes, so I don't care what is useful for teams, that is 100% irrelevant for how useful or comfortable a specific language is for me. Which is what my comment referred to, how much I enjoy, or not enjoy, writing in Go so far. I didn't call the language bad, I even said I'm too much of a simpleton coder to to have much use for arcane differences. I just said that after not even having finished my first project in Go I can already tell you, without any irony, that this brace style being enforced is a deal breaker for me. I'm still finishing the project, you know. If people have all these great reasons for not minding the lack of an option and not even having a choice, why are they so insecure about one individual minding it? My comment went to +5 shortly after posting and is now at -2, I think that's just hilarious ^^