Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

compact?!

- No Safe navigator: require 4 lines of code

- No ternary support: require 6 lines of code

- No map or filter functions (meaning you have to implement these in like 5-6 lines of code)

- Golang relies on built-in generator comments to help alleviate all of the typing.



Yeah, I'm not sure "compact" is a term I'd ever use to describe Go.

It's not as verbose as Enterprise™ Java, but hurdling that competition-height limbo-bar doesn't make something compact.


Arguments for compactness:

- Namespace system strongly favours single-word names

- Type embedding allows for single-dot access (not this.path.is.long())

- Zero-elements allow for elegant, zero-line initialization and existance checks, alleviating in part the need safe navigatorion operators.

Also I'd argue that the lack of map and filter are programmer nudges towards more elegant, compact solutions, but that's hard to prove. I've been annoyed with the lack of standard ways of doing things as well, but most often it turned out that I was simply doing it wrong, and Go was carefully designed to make the wrong way annoying to use. The compactness doesn't stem from using fewer lines to express simple constructs like if else, but the overall code organisation and structure that are the result of nudges like this one, as well as the code encapsulation they use (no classes, but interfaces and structs) and acyclic dependencies.

Generics will come out with the next version, though.


> No Safe navigator: require 4 lines of code

> No ternary support: require 6 lines of code

> No map or filter functions (meaning you have to implement these in like 5-6 lines of code)

I like that Go doesnt have these. Many programmers seem to want these big bloated programming languages. So thats what you end up with, a bunch of slow bloated programming languages. Personally I just want something like C, but with a couple of minimal extra features (maps, built in package management, bounds checking). For me, Go is the closest thing I have found to C, without many of the C pitfalls.

> Golang relies on built-in generator comments to help alleviate all of the typing.

I have been programming Go for a few years, and I have like one file in all of my code that uses a generator comment. That file is to interface with the Windows API. Regarding pure Go code, I dont use generator comments at all, so I think this comment is overblown.


> I like that Go doesnt have these. Many programmers seem to want these big bloated programming languages. So thats what you end up with, a bunch of slow bloated programming languages.

Those features are added to remove bloat from your source code.


I don't think you understand what bloat is. Just because an end user program has less lines of code, doesn't mean bloat is reduced. That code gets made up in the API, or the language itself.


No Safe navigator: require 4 lines of code

No ternary support: require 6 lines of code

I'm glad Go does not have those, it makes the code less readable. It's only useful for simple operation and very often chained and abused.


I very nearly got this ternary delight into FreeBSD src:

    if ((Lflag ? chown : lchown)(p->fts_accpath, s->st_uid, -1))
            (void)printf(" not modified: %s\n",
                strerror(errno));
which relies on the identical signature of chown(2) and lchown(2) syscalls.


This reminds me of the posts from 15 years ago saying why not having clipboard on iPhone was better.


Your point being that there’s no such thing as features that are better left out? Hard to believe


My point is that people develop attachment to things they own and use, and it's harder to be objective.


Well, obviously. GP used the phrase “compact and pretty”. It’s a bit of a stretch to interpret that as an objective statement. The charitable interpretation is that GP meant it to be subjective.

Edit: I got confused which post you were replying to. My apologies.


This is true of any defense ever made. Doesn’t say anything specific to this argument.


I really don't understand the hate that the ternary operator gets. If you know how to read if/else, you know how to read ?/:.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: