News for hackers. Stuff that matters.
Re:Green vs. Brown Programming Languages by brundolf on Thursday April 22, 2021 @11:04AM (#26903569)
I think there's a lot of truth to this, but I'm going to make an additional suggestion that I'll readily admit is biased by my own feelings:

I think Go is in a honeymoon phase and people will hate it in 10 years; I think Rust will continue to be liked even when it's a legacy language (perhaps no language can continue being loved once it becomes "brown", but I think Rust will be a lot less dreaded than others).

Go, like Ruby (mentioned at the end of the article), is optimized for building. You can do things quickly and easily with minimal ceremony. Some people love that. But that's exactly the trait that's starting to weigh on Ruby, and it's exactly the trait that has put PHP and Perl in the "dread" category over time (remember when people were in love with those?).

Rust on the other hand is optimized for maintaining (it's right there in the name: software should be allowed to become old and "collect rust"). Rust APIs are very hard to misuse, everything is constrained and specified very explicitly. Documentation and testing live inline with your code. You know exactly what a piece of code can and can't do - you even know whether it's allowed to mutate an object you're passing it. And of course certain mistakes are impossible to make at all without (again, explicitly) dipping into unsafe { }.

This kind of forethought is what makes a language that survives the honeymoon phase.

Re:Green vs. Brown Programming Languages by _6pvr on Thursday April 22, 2021 @11:21AM (#26903736)
> Rust on the other hand is optimized for maintaining (it's right there in the name: software should be allowed to become old and "collect rust"). Rust APIs are very hard to misuse, everything is constrained and specified very explicitly. Documentation and testing live inline with your code. You know exactly what a piece of code can and can't do - you even know whether it's allowed to mutate an object you're passing it. And of course certain mistakes are impossible to make at all without (again, explicitly) dipping into unsafe { }.

A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining. You could maybe make the argument that the guarantees provided by the language and compiler reduce the maintenance burden of software built in Rust, but I don't even really think that statement has been tested (via Rust being so young).

It is tiresome the frequency that legitimate language discussions for some reason turn into Rust vs. Go trash talking. It is almost certain that in 10 years, both will be used more than they are now by several x's. I think pretending you can predict what'll happen with either (and the industry) over that time is pretty silly. There will be legacy apps that people hate working with in all programming languages, and there's nothing that can save you.

Re:Green vs. Brown Programming Languages by brundolf on Thursday April 22, 2021 @11:33AM (#26903905)
My intention wasn't to trash-talk, and I admitted my bias up front. I'm just speculating, and I think that speculation is legitimate and relevant to the subject at hand.

It's my belief that whatever difficulty there is around onboarding people into Rust (setting aside the question of exactly how much of a problem that actually is or isn't) is "constant", where the difficulty of onboarding people into a legacy codebase is, shall we say, "polynomial" over time. Rust adds some constant overhead in exchange for reducing that polynomial growth, and my belief is that at some point the larger polynomials outpace it, ending up with more total difficulty for newcomers to a given legacy codebase. Of course time will tell.

Re:Green vs. Brown Programming Languages by throwaway894345 on Thursday April 22, 2021 @12:31PM (#26904694)
> constant vs polynomial

This is an interesting way to look at it, but I actually think this perspective favors Go considering that there is less variety across Go projects than other ecosystems, including Rust. Of course no programming language can hold constant the business domain, but there are things like which “error handling framework”, “for loops vs iterators”, “sync vs async”, “prefer owned vs borrowed by default”, etc that apply to Rust and not to Go. And of course, Rust lets you build some gnarly abstractions which simply don’t exist in Go.

Go gives you less choice, and thus projects are more similar, and thus I suspect legacy Go code adds will be easier to maintain.

Of course this property may not endure once Go acquires generics.

It should be said that I’m a big fan of both languages, and I am especially enthusiastic about Rust in that it fits my compulsion to have code that is both very abstract and very performant.

Re:Green vs. Brown Programming Languages by adkadskhj on Thursday April 22, 2021 @05:19PM (#26908341)
> Go gives you less choice, and thus projects are more similar, and thus I suspect legacy Go code adds will be easier to maintain.

Side note, Go gives you less tools - but not often less choice. Eg if you need to iterate and map, you still need to iterate and map. Go didn't change your application needs simply because it inhibited your ability to execute. Instead, you do what you need despite Go. Which often amounts to repeated functions, loops of loops, functions in loops to use defers, etcetc - you reinvent wheels. Go didn't reduce the application complexity, it just gave you less tools to solve it.

While some argue less tools is easier. I argue less tools often results in poor, messy abstractions. Those are traits that fight maintenance more than ease it, in my mind.

By the end of my Go tour, i was tired and wanted off the simplicity ride. The language was a burden, to me.

Re:Green vs. Brown Programming Languages by amscanne on Thursday April 22, 2021 @09:48PM (#26910207)
Ultimately you’re expressing an anti-simplicity sentiment, which is well aligned with the parent post. Clever abstractions may appear to reduce the “burden”, but they are often fashionable and add cognitive overhead. Go does indeed often force you to do things the “dumb” way (see your own examples) but the thesis is that this is easier to understand and maintain over time.
Re:Green vs. Brown Programming Languages by wtetzner on Saturday April 24, 2021 @12:52PM (#26926325)
> Ultimately you’re expressing an anti-simplicity sentiment

I disagree. First, making a language simple doesn’t make programs simpler, and often does the opposite.

I’m also not sure I buy the idea that Go is actually simple. It lacks a lot of features, but that’s not the same as being simple. I mean, it supports runtime reflection, which seems more complicated than features like traits or generics. And code using reflection is never simple.

Re:Green vs. Brown Programming Languages by BiteCode_dev on Friday April 23, 2021 @02:49AM (#26911738)
I'm sure somebody said something like that when all those kids started to the clever abstractions that were functions instead of doing things manually in assembly.

Simplicity!

Re:Green vs. Brown Programming Languages by throwaway894345 on Friday April 23, 2021 @09:32AM (#26914570)
This is just vapid snark. Of course some abstraction is helpful, but there's also a point at which abstraction impedes understanding. Ergo, we're debating where the "sweet spot" is. Note also that we can say "Go is the sweet spot for most applications" while also acknowledging that it makes certain kinds of programming difficult (e.g., writing a compiler). It's okay to recognize tradeoffs; there's no need to oversimplify or otherwise engage dogmatically.
Re:Green vs. Brown Programming Languages by carlhjerpe on Friday April 23, 2021 @07:06AM (#26913422)
Some developers don't want to use the ternary operator because it's "too complex".

I believe there's a middle ground to be found where further abstractions add complexity rather than reduce it. Where that middle ground is, I don't know.

Re:Green vs. Brown Programming Languages by wtetzner on Saturday April 24, 2021 @12:54PM (#26926344)
That’s a strange definition of complexity. I can see people avoiding the ternary operator because the syntax is hard to read, but it’s no more complex than `if`.
Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @01:01AM (#26911124)
Exactly, people advocate that there are those shipping stuff in Go, naturally there is the case.

Anyone that had to work with Assembly in production was happy to have any kind of high level language to start with.

Re:Green vs. Brown Programming Languages by brundolf on Thursday April 22, 2021 @12:43PM (#26904842)
> error handling framework

Not sure what's meant by this; Rust has a standardized Result type, with dedicated syntax for early-returning errors and type checks that make sure you handle them (or at least explicitly ignore them). Go, on the other hand, has a shaky error story and from what I've heard it's a constant problem due to enforcement-by-convention.

> prefer owned vs borrowed by default

Not really sure what this means either... the owner of a value generally falls out naturally from how you're trying to use it. It's not really an either/or option. It needs to live where it will be around long enough for everything that's done with it, and everything other than the owner should get a reference to it. Maybe you're talking about passing by reference vs implementing Copy? If so, that's mostly a performance concern.

> Of course this property may not endure once Go acquires generics

Yeah- one of the few things I like about Go is that it doesn't have generics (yet). I've seen generics make TypeScript codebases impenetrable, and I think there's a decent case to be made for not having them at all.

Re:Green vs. Brown Programming Languages by throwaway894345 on Thursday April 22, 2021 @01:09PM (#26905157)
> Not sure what's meant by this; Rust has a standardized Result type, with dedicated syntax for early-returning errors and type checks that make sure you handle them (or at least explicitly ignore them). Go, on the other hand, has a shaky error story and from what I've heard it's a constant problem due to enforcement-by-convention.

You may not like Go's convention (indeed, I don't love it although I think it works fine in practice), but the only error handling mechanism in Go is `if err != nil { ... }`. On the other hand Rust has many. This is not incompatible with your observation of "a standardized Result type". Here is a survey of the error handling landscape circa 2019: https://blog.yoshuawuyts.com/error-handling-survey/

> Not really sure what this means either... the owner of a value generally falls out naturally from how you're trying to use it. It's not really an either/or option

Or you have code which clones gratuitously out of convenience, often because some API unnecessarily asks for ownership of its arguments. Cloning is often just easier than battling the borrow checker, so in the real world with its deadlines, we tend to see a lot of clones because it's more convenient and performance is rarely a concern.

> I've seen generics make TypeScript codebases impenetrable, and I think there's a decent case to be made for not having them at all.

In fairness to TypeScript, I suspect much of this 'impenetrability' is because type annotations were added to existing JavaScript. I suspect the gratuitously complex types were already present in the original JavaScript, but the type annotations brought the pain to the surface. Similarly, I suspect TypeScript has a massive amount of developers who have only ever developed in JavaScript, many of whom are trying to shoehorn their bad JS habits into a statically typed language. You see this in other statically typed languages as well, but never on a scale that leaves a mark on the overall ecosystem.

That said, I think everyone should learn pre-generics Go if only to experience the value of an ecosystem that doesn't value egregious abstraction (again, I say this as someone who personally values egregious abstraction). And no, I don't think Java 1.0 counts (wherein people tried to shoehorn everything into implementation inheritance rather than generics).

Re:Green vs. Brown Programming Languages by adkadskhj on Thursday April 22, 2021 @05:20PM (#26908364)
> You may not like Go's convention (indeed, I don't love it although I think it works fine in practice), but the only error handling mechanism in Go is `if err != nil { ... }`. On the other hand Rust has many. This is not incompatible with your observation of "a standardized Result type". Here is a survey of the error handling landscape circa 2019: https://blog.yoshuawuyts.com/error-handling-survey/

By this definition, Go has many too. Go has lots of libraries to wrap error types, combine errors, preserve error data, etcetc.

Errors are one of the more similar things between Rust and Go, honestly.

Re:Green vs. Brown Programming Languages by throwaway894345 on Thursday April 22, 2021 @06:07PM (#26908757)
That’s a fair point. I forgot about the various errors packages in Go. I’ve been writing more Rust lately.
Re:Green vs. Brown Programming Languages by steveklabnik on Thursday April 22, 2021 @01:50PM (#26905683)
> Here is a survey of the error handling landscape circa 2019

All of this is helper functions built on the same identical core that your parent was talking about.

Not that that isn't its own kind of thing, but I think that the problems are different than "standard" vs "not standard"; this problem is only possible because there is a standard, and they all interoperate well with each other.

Re:Green vs. Brown Programming Languages by throwaway894345 on Thursday April 22, 2021 @02:22PM (#26906106)
Indeed, Rust has a very well thought-out core which enables variability (read: "complexity") of all kinds. Variability is a fine thing, but it is at odds with onboarding users from one project to another. I wasn't trying to overstate error handling in particular--I mentioned it briefly in a longer list of examples which in-aggregate affect one's ability to onboard to a new project. I also don't mean to convey that going between Rust projects is harder than in other languages on average--I don't think this is the case at all, only moreso than Go in particular.
Re:Green vs. Brown Programming Languages by void_mint on Thursday April 22, 2021 @12:55PM (#26904994)
> My intention wasn't to trash-talk, and I admitted my bias up front.

I apologize if my statement came off aggressive - I wasn't necessarily trying to say that you're shit talking specifically, just that it seems like lots of/most programming language discussions on HN devolve into some form of "Rust Good Go Bad" or "Go Good Rust Bad", which I think is usually just inflammatory.

Your prediction is 100% bias-based. There are equal (probably more) developers that would say the same thing you said, but with Go being the language that sticks and Rust being the language that's hated. The bias is the entire answer. An unbiased answer is "Who knows" and "Probably both will be loved and hated".

Re:Green vs. Brown Programming Languages by reducesuffering on Thursday April 22, 2021 @01:24PM (#26905338)
> Your prediction is 100% bias-based. There are equal (probably more) developers that would say the same thing you said, but with Go being the language that sticks and Rust being the language that's hated.

It actually sounds like your answer is more bias-based, because your intuition is more wrong here. There is data from the 2020 Stack Overflow survey[0] indicating a significant lead for devs who use Rust and continue to want to develop in it, vs. Go. 86.1% Rust vs. 62.3% Go.

[0]https://insights.stackoverflow.com/survey/2020#most-popular-...

Re:Green vs. Brown Programming Languages by lyjackal on Thursday April 22, 2021 @06:20PM (#26908857)
In the context of the article, I think that can be attributed to age (go is older than rust, so trending towards the "brown field." See for example Scala, which is a little bit older, and ended up in both loved and hated lists. I'd speculate that Go will be in the same camp in 4 years or so based on polarized sentiment I've observed.

That being said, there may be something about strict/complicated languages like scala and haskell that tends to polarize developer sentiment. Rust seems like it could fall into that same pattern based on the "up front" work that it demands.

Re:Green vs. Brown Programming Languages by nindalf on Friday April 23, 2021 @01:29AM (#26911276)
Those numbers aren’t comparable.

Go and Rust don’t have similar numbers of developers. My intuition is that Go has an order of magnitude more. It’s like comparing product reviews on a shopping website - 4.7 based on 20 reviews vs 4.3 based based on 200 reviews. It’s hard to say which is better. You’d have to go deeper into each of those reviews to learn if the pros and cons apply to your use case.

Another important metric, as OP pointed out, is the age of the code base these devs are working on. Rust devs are probably working on code bases they started and Go devs are maintaining someone else’s code base.

That said, I agree with the current top comment on the thread - Rust code based may prove easier to maintain when we look back 10 years from now.

Re:Green vs. Brown Programming Languages by void_mint on Thursday April 22, 2021 @11:51PM (#26910806)
> It actually sounds like your answer is more bias-based, because your intuition is more wrong here. There is data from the 2020 Stack Overflow survey[0] indicating a significant lead for devs who use Rust and continue to want to develop in it, vs. Go. 86.1% Rust vs. 62.3% Go.

That's great to hear. Unfortunately, language popularity in enterprise/production environments isn't really based around how much a developer loves or hates something.

There are more Go programs/programmers now than Rust, was the basis of my post that you're objecting to, which can be verified if you scroll up on the link you posted.

Re:Green vs. Brown Programming Languages by mumblemumble on Thursday April 22, 2021 @11:47AM (#26904096)
> A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining.

I'm not so sure about that. (Or perhaps the definition itself needs scrutiny?) Most the languages I've seen get a reputation for being easy to learn have also subsequently earned a reputation for being a maintenance hassle: perl, ruby, python, php, javascript, etc.

Re:Green vs. Brown Programming Languages by bradleyjg on Thursday April 22, 2021 @06:17PM (#26908829)
I think this is probably selection effects rather than language features. Easier languages disproportionately attract weaker programmers.
Re:Green vs. Brown Programming Languages by Too on Saturday April 24, 2021 @01:19AM (#26922453)
Likely both. Duct tape is easy to learn, but it's not a good tool to use when building a house. Due to properties of the tool, not because it attracts bad carpenters preferring to use duct tape.

Combine both these factors and you have a real amplified problem on your hands.

Re:Green vs. Brown Programming Languages by mayama on Thursday April 22, 2021 @11:26PM (#26910680)
Easier languages tend to get popular easier as well, which lends itself to companies being able to hire more.
Re:Green vs. Brown Programming Languages by toxik on Thursday April 22, 2021 @04:56PM (#26908093)
Language nitpick in the parent’s comment: “touted” is definitely the wrong word here, to tout is to solicit.
Re:Green vs. Brown Programming Languages by perl4ever on Thursday April 22, 2021 @05:54PM (#26908649)
"touted" has a positive connotation to me, so it doesn't sound right to tout negative aspects of something. But the meaning seems clear.
Re:Green vs. Brown Programming Languages by yesenadam on Thursday April 22, 2021 @06:23PM (#26908879)
> “touted” is definitely the wrong word here,

Uh, no. In Merriam Webster, that's meaning #2. Meaning #1 is

> to make much of : promote, talk up

> touted as the summer's blockbuster movie

> the college's much touted women's studies program

https://www.merriam-webster.com/dictionary/tout

Re:Green vs. Brown Programming Languages by mumblemumble on Thursday April 22, 2021 @08:42PM (#26909821)
Realistically, that first definition is slightly ambiguous; it may or may not mean to imply that the talk is supposed to be promotional and not derisive in order for the definition to apply. I am guessing that they probably did mean to imply that connotation, though, based on other information on the page.

I'd argue, though, that the reality is that the word's meaning is in the process of shifting from being a synonym for "promote" to being a synonym for "make out to be"; that reflects much common usage, and dictionaries always lag behind a bit in cases like this. They have to - they're a descriptive artifact, not a prescriptive one.

Re:Green vs. Brown Programming Languages by toxik on Friday April 23, 2021 @02:33AM (#26911599)
Which is also positive in its tone. It’s the wrong word.
Re:Green vs. Brown Programming Languages by agalunar on Thursday April 22, 2021 @06:48PM (#26909051)
The sense here is

1 : to make much of : PROMOTE, TALK UP

as opposed to

2 : to solicit, peddle, or persuade importunately

https://www.merriam-webster.com/dictionary/tout

Edit: uups! Didn't reload the page and see yesenadam's comment before posting. Sorry about that!

Re:Green vs. Brown Programming Languages by toxik on Friday April 23, 2021 @02:35AM (#26911609)
It was promoted as hard to learn? What. Neither definition fits.
Re:Green vs. Brown Programming Languages by sanderjd on Thursday April 22, 2021 @11:28AM (#26903846)
> It is almost certain that in 10 years, both will be used more than they are now by several x's.

That's why so many threads end up being about Rust vs. Go. They are the new(ish) languages that appear most likely to be real factors in the industry for a very long time, so they bear more discussion.

I wasn't really around for it, but I'm sure there were lots of discussions about Java vs. C++ earlier in their lifespans, for this same reason.

Re:Green vs. Brown Programming Languages by ehvatum on Thursday April 22, 2021 @12:11PM (#26904429)
> I'm sure there were lots of discussions about Java vs. C++ earlier in their lifespans

Rewind to 1996. I’m at the Networld/Interop conference in Las Vegas. The steel skeleton of the Ballagio looms over desert mirages, and Java is all things to all people: a wide-open utopia to be populated by new and perfect code, a new world without concern for memory management, an abstraction from everything freeing us all from needing to know anything.

Re:Green vs. Brown Programming Languages by HWR_14 on Thursday April 22, 2021 @03:45PM (#26907279)
> A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining.

I disagree. The things that make for good maintenance correlate with both difficulty to learn and difficulty to onboard. (The converse is not true.) Things that are easily to learn tend to be easy to start with, but end up tacking on, via frameworks or coding standards, pieces that raise both difficulty to learn and to onboard as complex projects exist.

Specifically, maintenance requires thinking like the person or people who initially created the code. The more your thinking aligns with them, the easier it is to maintain. And that act of changing to think like them is learning and onboarding.

Re:Green vs. Brown Programming Languages by Ygg2 on Thursday April 22, 2021 @12:52PM (#26904966)
I can learn any language in a day or two. And become proficient in it in a week.

Big part of mastering is less about knowing the language and knowing its plumbing. Quirks, unique behavior, library, tooling, etc.

Dynamism is a constant source of pain. Because it makes tooling and thus exploring language harder.

In Rust there is little such dynamism. Actual problems understanding are macros and proc macros. And finding the right Trait.

Tooling around Rust is standarized. You have cargo, rustc and they bring in the rest.

While there is some chance of Rust going nuts and adding some bizzare thing like inheritance, HKT++, the chance that it will reach cognitive complexity of Scala or C++ is lesser.

Re:Green vs. Brown Programming Languages by Decabytes on Thursday April 22, 2021 @04:28PM (#26907765)
I program in Python by day. Racket is probably the language I know best after Python, then maybe Groovy. I've had exposure to R, C, C++, D, Java, Common Lisp etc, and I find it easier to pick up new languages due to my familiarity.

While Rust has all the constructs that I'm used to from these other programming languages, I find Rust to be the most difficult one for me to learn in recent memory. The documentation is great, the book is great, the tooling with Cargo is great, but after getting through the first 15 chapters in the Book I struggled to write a program that had any sort of complexity. Sure I can add a dependency super easily to my project, but figuring out what errors everything in the library throws takes a lot of work. Sometimes I get confused about using panic!, expect, unwrap, or ? when I'm writing my own functions or interfacing with others. Swimming through the myriad of traits on different structs is confusing, and I sometimes get tripped up passing closures. And don't get me started on Macros, with great shame, they still have not clicked for me, in Lisp, or in Rust. The language just feels very different from what I'm used to, and I've never had such a hard time getting code I've written to compile correctly. I'd be totally lost without all the help from the subreddit and the book, and I appreciate everyone who has helped me.

I know this will get easier... and it has. But it will take longer for me to get comfortably with Rust then it has for other programmings languages in the same time period. This is not to say that it's a bad language. I remember one day after having debugged a Python issue that ended up being a stupid logic error on my part I exclaimed "I wish I knew a programming language that would save me from myself". I think... Or rather I hope Rust is that language in the long term for me

Re:Green vs. Brown Programming Languages by jokethrowaway on Thursday April 22, 2021 @08:01PM (#26909578)
I think you missed some Haskell (or some other functional / category-theorish language) in your baggage of languages.

Coming from Haskell, Rust felt like a weird C-like home.

It's a weird marriage, but it makes for a language which make very predictable software imho

Re:Green vs. Brown Programming Languages by sanxiyn on Thursday April 22, 2021 @07:35PM (#26909414)
> The language just feels very different from what I'm used to

The reason it feels very different is... because it is very different. Then why does it feel off? Because, while it is very different, it doesn't look very different. Then why doesn't it look very different, when it is very different?

That's because, Rust developers spent conscious effort to make Rust look similar. So feeling something is off with Rust is the result of intentional design of Rust developers. In a sense this is dishonest and deceiving, but Rust without similarity engineering would be considerably less popular and hence less successful.

Rust's ambition was to change the world, not simply to discover a way to change the world and leaving actual changing to others. (Although changing the world requires discovery first.) So Rust chose to "lie".

As an example, Rust's assignment(=) looks similar, but works very different. In fact, since it is very different, it was originally written <-. It was changed to = specifically to make it look similar.

Re:Green vs. Brown Programming Languages by sanxiyn on Thursday April 22, 2021 @11:05PM (#26910588)
Another example is std::mem::swap. In the world of affine type system which Rust uses, swap is a primitive on an equal footing with assignment (which is actually called move). So naturally, move was written <-, and swap was written <->.

But <-> weirded people out, and people complained why Rust has so many special and strange operators. So Rust developers made it look similar to a library function. But it still is a primitive: it is impossible to implement swap yourself in safe code.

The result is that people use swap much less than they should, either because they are not aware of it, or because they think it is a specialized library function for special cases. This is significant and large cost. But it is still less than cost of looking weird. All because people won't even try languages with <->. Alas.

Re:Green vs. Brown Programming Languages by nandhinianand on Monday April 26, 2021 @12:45AM (#26939317)
One of the side-effects of this is that, Reading Rust code is painful.. it is a bit like reading old perl or haskell code you haven't looked at. Especially when rust is not the day job it gets complicated/painful to remember the distinctions between "=" in say python(that's what i use most) vs "=" in rust. This is not necessarily a bad thing, but it does contribute to that previous posters' point out finding errors or bugs from libraries being used hard to find or fix. Once again, I don't care much for go, but rust is one of the languages that excite me, but trying to level up in rust(beyond the trivial tutorial code/projects) seems to need a dedicated "maker time' schedule rather than spending 30 mins- 1 hour spare time in between distractions from children.
Re:Green vs. Brown Programming Languages by Izkata on Thursday April 22, 2021 @10:55PM (#26910545)
> it was originally written <-. It was changed to = specifically to make it look similar.

That's actually kinda disappointing, I use <- in my pseudocode.

(I don't know Rust though, so I can't comment on their choice for the language)

Re:Green vs. Brown Programming Languages by pkolaczk on Saturday April 24, 2021 @01:31AM (#26922505)
I program in Python at my job and Rust in a hobby project. It surprised me how easy and productive actually Rust is, and I was really very sceptical initially. I know it is very subjective, and possibly a result of my longer exposure to statically typed languages, but simply Rust felt quite natural to me, while Python still feels very quirky, irregular and sometimes outright annoying, despite me spending more time with Python than Rust.
Re:Green vs. Brown Programming Languages by aranchelk on Thursday April 22, 2021 @11:43AM (#26904038)
I use neither Go nor Rust and don’t have an opinion, but it’s worth pointing out that “difficult to learn” is highly contextual, e.g. Python or Ruby were probably relatively easy to learn if you already knew Perl or PHP. I found Haskell quite difficult to learn. Subsequently PureScript was very easy. Widely shared knowledge and concepts change over time and they will affect ease of adoption.
Re:Green vs. Brown Programming Languages by the__alchemist on Thursday April 22, 2021 @02:00PM (#26905796)
I wouldn't call Rust difficult to learn. The syntax quirks (Knowing where to put `&` etc takes time, and traits are abstract, but used all over Rust codebases). For example: Look at Python which is typically considered easy to learn. In Rust, I know that I can create a project using official tooling; specify dependencies cleanly in `Cargo.toml`; use the built-in linter, and formatter. Check the Rust docs page for any dependencies, including type signatures for all functions, and a list of struct fields. Look in the `examples` folder of a dependency's repo for code snippets.

In Python, I'm likely to find a comparative mess of sparingly-documented documented third-party tools, dependency docs, and Stack Overflow posts.

Or, look at embedded, where C is considered a simple language. In C, it's not obvious how I'd start. Use something like Cube-MX or Keil? GCC? All the options are messy and tough to learn. In Rust, I clone a template repo, cargo-install 2 or 3 tools and targets, and `cargo run` to compile and flash.

Re:Green vs. Brown Programming Languages by valand on Friday April 23, 2021 @01:38AM (#26911307)
> I wouldn't call Rust difficult to learn

I agree with this too.

This is because you know what Rust brings you compared to what you used in the past that cause you pain.

Unfortunately, some people that have difficulty learning Rust (or hear about it) focus solely on the learning process and not what they gain by learning it.

Learning a low-level language is inherently hard because there are more at stake, it is simply more complex. For people that work where dangling pointer, data-races, is never a problem, they are learning about the problem the same time they are learning about the solution (Rust's ownership concept), and I came from that place too.

Re:Green vs. Brown Programming Languages by nec4b on Friday April 23, 2021 @04:09AM (#26912300)
> Or, look at embedded, where C is considered a simple language. In C, it's not obvious how I'd start. Use something like Cube-MX or Keil? GCC? All the options are messy and tough to learn. In Rust, I clone a template repo, cargo-install 2 or 3 tools and targets, and `cargo run` to compile and flash.

Keil is a company that builds an IDE, compiler and debuging tools for microcontrollers. CubeMx is a configuration tool/code generator for STM microcontrollers. You comment makes no sense in regards to C language, unless you are saying that rust/cargo automagically does everything that Keil products and CubeMx do?

Re:Green vs. Brown Programming Languages by the__alchemist on Friday April 23, 2021 @05:57PM (#26919675)
Correct:

- `cargo install probe-run`

- `rustup add `thumbv8m.main-none-eabihf`

- `git clone some-template`

- `cargo run`

Re:Green vs. Brown Programming Languages by nec4b on Saturday April 24, 2021 @04:56AM (#26923425)
Wait, these 4 commands create an IDE with with JTAG debugging support, tracer and a profiler and than configure all the chip's peripherals, add low level drivers (UART, SPI, USB, FS, I2C, ETHERNET,...), setup clocking and power settings and add RTOS? I took Keil probably decades and STM years to write all that complex tooling. I'm mean it probably takes an engineer a month to bring new HW to life with the help of all those tools before they can start writing application firmware. Are you really saying 4 lines of rust tooling do the same in couple of seconds? That would be some amazing AI behind those 4 lines.
Re:Green vs. Brown Programming Languages by the__alchemist on Saturday April 24, 2021 @12:39PM (#26926206)
Those lines let you compile, flash, and debug. For IDE, I prefer the IntelliJ Rust plugin. Some people prefer VsCode instead. The point here is that you choose an editor suitable to the language, with the code-editing and project-management features you like.

Low level drivers are usually handled using libraries of 2 general categories: Peripheral access crates (PAC) (mostly) auto-generated from SVD files; HALs that provide an abstraction over the PAC.

A month to get started sounds... intense, depending on the project. What drove (drives?) that? Let's say I want to do a simple project using STM32. Something simple that reads sensors, has a few buttons, and outputs to a display. I'd choose parts, put together a layout in a PCB design software, and order the boards, which arrive within 2 weeks. In the meanwhile, use a dev board as required. Find a driver for the sensor, screen etc if it exists. If not, write them using the datasheet. Use a HAL to take configure clocks and peripherals, write the control flow logic (Perhaps based on interrupts). For anything the HAL doesn't support, use the Reference Manual and the PAC to set the appropriate fields.

Setting up I2C might be something like this, using a HAL:

    let mut scl = gpiob.new_pin(PinNum::P6, PinMode::Alt(AltFn::Af4));
    scl.output_type(OutputType::OpenDrain, &mut gpiob.regs);

    let mut sda = gpiob.new_pin(PinNum::P7, PinMode::Alt(AltFn::Af4));
    sda.output_type(OutputType::OpenDrain, &mut gpiob.regs);

    let i2c = I2c::new(dp.I2C1, I2cDevice::One, 100_000, &clock_cfg, &mut dp.RCC);
Re:Green vs. Brown Programming Languages by nec4b on Saturday April 24, 2021 @03:22PM (#26927567)
The only thing that I did for STM32 was writing drivers for dual FLASH quad SPI external memory. Since I didn't know much about STM32 and there was no sample driver for the flash chip I was using, CubeMX helped quite a lot. It still took me a good week to get it working.

Usually when developing a new platform for our products, I/we need to bring to life: SDRAM, LCD, touch controller, external flash for code and data, SD card + FAT32, USB, ETH, plus a bunch of other components (ADC, DAC, BT, other uC, latches,...) using the usual peripherals (UART, SPI, I2C, timers,...). Keil provides a good compiler and linker, fast JTAG debugger, RTOS and a bunch of middleware libraries (some are quality, some are lacking). While I dislike its IDE for writing code, it is a lot better than VS code for debugging purposes. It also supports flashing and erasing MCUs with internal and external memory, which sometimes requires special programming algorithms.

For us stability, tooling and good library support is the most important part of doing our job. Language follows from there. C and C++ have the advantage of the GNU/Linux ecosystem of open source to draw from and they map to the hardware almost perfectly. On higher level systems (Android, Linux) we use higher languages (with GC) which have even nicer tooling and better libraries for writing application code.

Re:Green vs. Brown Programming Languages by the__alchemist on Saturday April 24, 2021 @04:13PM (#26927937)
Nice. It sounds like the time sink there is writing drivers for a range of peripherals. The silver lining is next time you use that periph, it's easier.
Re:Green vs. Brown Programming Languages by petre on Thursday April 22, 2021 @02:27PM (#26906186)
C/C++ and Rust are both hard IMHO. D is way easier, one gets productive quite fast and there are also more advanced language features once you get proficient in it, unlike Go.
Re:Green vs. Brown Programming Languages by zozbot234 on Thursday April 22, 2021 @12:19PM (#26904538)
> A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining.

Rust is not more "difficult to learn" or "difficult to onboard" than C++. And C++ is certainly a language with plenty of legacy, enough that you could reasonably call it "brown". Go is a rather different language that's perhaps best compared with Java as its closest "brown" counterpart.

Re:Green vs. Brown Programming Languages by void_mint on Thursday April 22, 2021 @12:43PM (#26904848)
> Rust is not more "difficult to learn" or "difficult to onboard" than C++.

Saying Rust isn't more difficult than possibly the most difficult thing is not a good argument in favor of Rust not being difficult, no?

People dread maintaining legacy C++ systems. People dread maintaining legacy systems. Rust will be no different.

Re:Green vs. Brown Programming Languages by kevin_thibedeau on Thursday April 22, 2021 @06:55PM (#26909112)
The problem with C++ is that the various standards have encouraged changing idioms. Pre-standard, 98, 11, and 17 are significantly different when the new language features are fully leveraged. Legacy code creates inconvenient barriers when interoperating with modern stuff. Rust may be able to escape this problem.
Re:Green vs. Brown Programming Languages by resonantjacket5 on Thursday April 22, 2021 @07:11PM (#26909241)
I mean eventually there's going to be rust 2 etc...
Re:Green vs. Brown Programming Languages by nindalf on Friday April 23, 2021 @01:40AM (#26911318)
Rust, unlike other languages I know of, has a well defined process to make breaking changes to the language. These changes are opt-in on a crate level so you don’t need to migrate an entire code base in an instant. The team also ships tools to auto fix code out there to make the migration easier.

The 2018 edition had a few small breaking changes, the 2021 edition will have none. Personally I hope the 2024 edition makes some breaking changes to make IDE development easier.

Re:Green vs. Brown Programming Languages by Too on Saturday April 24, 2021 @01:10AM (#26922409)
C++ is backwards compatible the same way and there was never any need to migrate your code. What happened was that c++11 brought in a major set of new features, changing the best practices of how to use the language, almost to the point of making it a new language. Mainly smart pointers, initializers, type inference, threading and lambdas, and removing tons of other small rocks in the shoe.

So that someone familiar with c++11 or newer opening up a legacy code would maybe not have a hard time understanding it but they would go "wtf is this verbose shit" and be tempted to rewrite it. Vice versa an old schooler would need to relearn these new features when opening a new code base.

Re:Green vs. Brown Programming Languages by steveklabnik on Thursday April 22, 2021 @07:23PM (#26909322)
Not from the Rust project; someone else would have to come along and build it.
Re:Green vs. Brown Programming Languages by resonantjacket5 on Wednesday April 28, 2021 @10:39PM (#26976863)
I mean there will be more and more changes to Rust, just like how C++ has had many changes over the years. Rust 2020, .. 2025, 2026 etc..
Re:Green vs. Brown Programming Languages by aidenn0 on Thursday April 22, 2021 @11:48AM (#26904104)
I cannot write a program from scratch in Haskell. I just can't wrap my brain around it. However, every time I've needed a new feature in a program I use written in Haskell, it's been easy and a pleasure to implement.
Re:Green vs. Brown Programming Languages by kazoomonger on Thursday April 22, 2021 @11:32AM (#26903889)
I doubt Go will be used in the future more by several times than it is now. Looking at Google Trends, we're past peak Go, it's now on the decline:

https://trends.google.com/trends/explore?date=all&geo=US&q=%...

I haven't seen anything that would indicate anything else than Go slowly declining much like Ruby has. In other words, it's still around and getting new updates, but losing mindshare.

Re:Green vs. Brown Programming Languages by nr0mx on Thursday April 22, 2021 @11:43AM (#26904042)
By that metric, doesn't Rust have an even bleaker future? https://trends.google.com/trends/explore?date=today%205-y&q=...
Re:Green vs. Brown Programming Languages by kazoomonger on Thursday April 22, 2021 @11:50AM (#26904130)
My response was more doubting that Go is going to be used many times more than it is currently 10 years down the line, but the trend on Rust is upwards:

https://trends.google.com/trends/explore?date=all&q=%2Fm%2F0...

That doesn't mean it will ever achieve popularity, and could also go away.

However, with the Go developers' insistence on changing the language as little as possible (not good or bad, it just is), it seems unlikely that Go will see a resurgence that brings it to multiple times usage than it has now.

Re:Green vs. Brown Programming Languages by mayama on Thursday April 22, 2021 @11:33PM (#26910716)
But, they are working toward Go2. Generics, which are the biggest talking point whenever Go is discussed, is already added in a branch and is supposed to come in a year or so. It'll be interesting to see how it'll affect the trends data after that.
Re:Green vs. Brown Programming Languages by catgary on Thursday April 22, 2021 @11:55PM (#26910830)
Do they actually have people who are experienced with type theory working on the type system, or is it the same core team?
Re:Green vs. Brown Programming Languages by lfnoise on Friday April 23, 2021 @02:57AM (#26911803)
Re:Green vs. Brown Programming Languages by dhosek on Friday April 23, 2021 @12:00AM (#26910848)
Not really because the difference is that the overall trend on Rust is still upwards (it's hard to see with the two languages on the same axis). I've been investigating Rust and it looks like it's going to cure the pain points I've had around C++ on a project I'm working on and I'm quite happy with it so far.
Re:Green vs. Brown Programming Languages by ncann on Thursday April 22, 2021 @11:43AM (#26904043)
The funny is if you use "golang" as the term it peaked at a different time (2019-2020), but then there was a very sharp drop at the beginning of this year. I wonder what the reason is?

https://trends.google.com/trends/explore?q=golang&date=all&g...

Re:Green vs. Brown Programming Languages by Macha on Thursday April 22, 2021 @12:07PM (#26904369)
Google is not perfect at distinguishing which queries for the word "Go" are actually about the Go programming language.

Referring to the language as golang is a secondary name, popularity driven by Google's own performance surfacing go (language) related results for the word go.

Go (programming language) has the same january drop as golang, clearer when both are viewed together:

https://trends.google.com/trends/explore?date=all&geo=US&q=g...

I don't think Go actually is substantially less popular in Febuary 2021 than November 2021 (January/December, maybe due to people/student vacation time), but the google trends anomaly is not a go vs golang naming distinction.

Re:Green vs. Brown Programming Languages by nloa on Friday April 23, 2021 @04:35PM (#26918913)
That’s quite interesting. I’ve added Typescript and Ruby to the chart - apparently they are all declining in popularity. But I wonder, which language is the one currently rising then?
Re:Green vs. Brown Programming Languages by dpatterbee on Thursday April 22, 2021 @11:40AM (#26904003)
On the other hand, searches for "golang" matched their all-time high in July 2020.
Re:Green vs. Brown Programming Languages by kazoomonger on Thursday April 22, 2021 @11:44AM (#26904057)
Not sure what you mean. This chart shows the peak as being in 2019, and declining since then:

https://trends.google.com/trends/explore?date=all&geo=US&q=g...

Re:Green vs. Brown Programming Languages by fwip on Thursday April 22, 2021 @12:04PM (#26904328)
You're looking at US, the Worldwide view matches July 2020.
Re:Green vs. Brown Programming Languages by orwin on Thursday April 22, 2021 @12:01PM (#26904289)
> A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining.

Disagree. First, difficult to learn is not difficult to onboard. Second, unless you think Ocaml is not hard to learn, i think this is a great counterexample.

Re:Green vs. Brown Programming Languages by solipsism on Thursday April 22, 2021 @12:20PM (#26904550)
It is almost certain that in 10 years, both will be used more than they are now by several x's. I think pretending you can predict what'll happen with either (and the industry) over that time is pretty silly.

You contradict yourself.

Re:Green vs. Brown Programming Languages by shinjitsu on Thursday April 22, 2021 @01:48PM (#26905641)
I think the "difficult to learn" and "difficult to onboard" is important to keeping rust a "Most Loved Programming Language". If only those who make it through the "difficult to onboard" phase use the language extensively, then only they will be responding to the "most loved"/"most dreaded" question.

I taught a university seminar that looked at rust and another emerging language a couple of years ago and only 2 students out of 30 said they would use rust again after the class. So the rest will never get a chance to answer the survey question about rust.

Re:Green vs. Brown Programming Languages by emteycz on Thursday April 22, 2021 @07:39PM (#26909451)
> A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining.

Strong disagreement here.

It could be difficult because it's built for maintaining.

People who are unable to understand Rust are the people you don't want anywhere near your C/C++/Rust project.

Re:Green vs. Brown Programming Languages by valand on Friday April 23, 2021 @01:22AM (#26911237)
> A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining

PL learnability alone is not significant as a factor for a PL to be chosen for a certain task, unless it is impossibly hard. Rust, looking at the growing community, is not a PL that is impossibly hard to learn.

A PL is chosen for a certain task for its features. The same as any other class of tool, "A is chosen for X because of A's feature".

The learning curve is simply the side-effect of the PL's minimum features need to be learnt for it to work. Rust being a low-level language + an extra layer of protection is inherently hard.

But let's see how it fares in 10 years. There have been successful projects built on Rust, firecracker, figma, discord, and many more, despite it being so young.

Re:Green vs. Brown Programming Languages by derefr on Thursday April 22, 2021 @07:26PM (#26909352)
> A language that is touted as "difficult to learn" and "difficult to onboard" is by definition not built for maintaining.

I think this presumes that you have to teach people the language. But most maintenance programming is done by hiring people already familiar with the language the existing codebase is written in, and then bringing them on to work on the existing project.

Rust isn’t hard to onboard for an individual project, in the same way that a macro-laden Lisp codebase is. Once you know Rust, you know Rust. It takes more effort to “know Rust” because you have to learn all the ecosystem stuff expected of someone who “knows Rust”; but from the perspective of an employer, you can just hire “someone who knows Rust”, and they’ll come with all that knowledge.

And, in fact, an experienced Rust dev may be able to start work on a novel-to-them existing Rust project, a lot faster than (for example) an experienced C dev would on a novel-to-them existing C project, as a large stdlib / conventional ecosystem of foundational libraries (as in the case of Rust) tends to translate well to experienced developers coming into a codebase and quickly recalling everything, because it’s a bunch of the same batteries/libraries they’ve already used in the past.

The difference between a design pattern and a language feature, is that you can recall language features, while you have to recognize design patterns (i.e. grok the code in order to identify what pattern(s) it’s trying to reify.) Languages with more formalisms (either built into the language, or in common use in the ecosystem) increase the amount of recall that new maintenance programmers can do (or rather, decrease the amount of recognizing they have to do to get up-to-speed), and thus make switching a maintenance programmer between codebases “cheaper.”

—————

I bring this up not from the perspective of a Rust programmer, but from the perspective of an Erlang programmer... who also doesn’t like Go very much (though I do write quite a lot of Go! As a maintenance programmer!)

IMHO Erlang and Go aren’t all that fundamentally different runtime-wise. Presuming you’re using them for the same thing — writing highly-concurrent, fault-tolerant network servers — the main difference between the experiences of coding in Go and in Erlang, comes down to the fact that Go provides you with a bunch of concurrency primitives that you have to put together as design patterns — and where maintenance programmers then have to recognize those patterns; while Erlang actually has universal concurrency formalisms that everyone takes advantage of, and so those formalisms can simply be recalled on new projects.

I advise anyone who thinks that “recognizing design patterns” is a cheap-and-easy thing to do, to tell me what’s going on in this file: https://github.com/ethereum/go-ethereum/blob/master/eth/down... . I’ve stared at this code on-and-off for two years, and I still don’t have a mental model for it. If this code was made out of cleanly-separated named/opaque formalisms, rather than fifty design-patterns tied into a knot, I can’t even imagine how much more productive I would have been working on it.

Re:Green vs. Brown Programming Languages by cbsks on Thursday April 22, 2021 @12:24PM (#26904607)
> A language that is touted as "difficult to learn" and "difficult to onboard"

Does anyone know if there have been studies about how long it takes to learn different programming languages? I hypothesize that it would take a beginner programmer longer to learn Rust than C, but probably a similar amount of time as learning C++ (which I think is the closest “traditional” programming language to Rust).

Re:Green vs. Brown Programming Languages by woah on Thursday April 22, 2021 @12:00PM (#26904275)
Have you ever maintained a piece of Rust code?
Re:Green vs. Brown Programming Languages by void_mint on Thursday April 22, 2021 @05:21PM (#26908365)
Yep!

edit I am amused at this downvote. I was asked a yes or no question, and responded with a yes. What could possibly make this response downvote-worthy?

Re:Green vs. Brown Programming Languages by Laremere on Thursday April 22, 2021 @11:27AM (#26903822)
It seems reasonable to argue the exact opposite: (edit: for clarification, I think this argument is roughly equal in strength to the parent. My bias is definitely showing, but my main point is that knowing which will be true is hard.)

Go was built explicitly to solve the real everyday problems of working in a large code base, largely driven directly by experience of several industry titans. It mostly remixes what has proven to work into a cohesive package. It's only as large as it absolutely needs to be (so new devs can learn it quickly), and has a strong focus on developer UX (gofmt, build speed, godoc).

Rust on the other hand is a far more ambitious language. It's trying to statically solve many types of problems which are typically solved through testing and experience. Using Rust productively requires much more Rust specific learning. With how Rust is changing and having multiple approaches to things as the language is defined, long living code bases are going to accrue different methodologies from whatever was popular when each component was written.

I think in 10 years a few experienced devs will do to Rust what Go did to C: Take the bits that obviously worked well, add a few ideas from other languages to soften some rough corners, and present it is a smaller, easy to use package. Though I also in general hope old languages are being replaced by new languages, as that must happen if as an industry we are getting better at building software. But also because I'm making a programming language and I have to believe I've found room for improvement for that to be a good idea.

Re:Green vs. Brown Programming Languages by coldtea on Thursday April 22, 2021 @11:49AM (#26904123)
>Go was built explicitly to solve the real everyday problems of working in a large code base, largely driven directly by experience of several industry titans.

Several quite opinionated industry titans who appeared to ignore most things they didn't themselves invent in AT&T for UNIX or in Plan 9, and based on their own preconceptions of "programming at scale" as a pet project (not based some formal Google-initiated research on its practical needs).

Algol and ADA were indeed created by "experience of several industry titans", in a process examining the field of applications and use cases for the languages.

Go was not really that, whatever the story says.

Re:Green vs. Brown Programming Languages by AnimalMuppet on Thursday April 22, 2021 @01:06PM (#26905126)
> and based on their own preconceptions of "programming at scale" as a pet project

Based on their experience working at Google. It wasn't just "preconceptions". (True, it also wasn't an examination of the field of the form that led to Algol and Ada, but it wasn't just preconceptions, either.)

Re:Green vs. Brown Programming Languages by coldtea on Thursday April 22, 2021 @01:28PM (#26905382)
>Based on their experience working at Google.

Yes, but that's their experience working at Google as 30+ years industry veterans and thought leaders (one would guess, mostly left to do their own thing, as prestige hires).

Not as regular developers doing everyday Google grunt-work...

Re:Green vs. Brown Programming Languages by AnimalMuppet on Thursday April 22, 2021 @01:30PM (#26905413)
Well, the founding myth of go says that it started from a conversation during a 45 minute C++ compile. I doubt that that was Rob Pike's personal "thing" project - he hadn't been there long enough to have a personal project that size. That was some big multi-person multi-year thing.
Re:Green vs. Brown Programming Languages by srparish on Thursday April 22, 2021 @03:54PM (#26907398)
They had the limbo language in plan9, which has similar features and quirks. It seems most probable that the outcome of the 45 minute conversation wasn't "let's build a language from scratch", but rather "let's iterate on limbo".
Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @02:32AM (#26911586)
You can get the details here,

"Creating the Go programming language featuring Rob Pike & Robert Griesemer"

https://changelog.com/gotime/100

There are other sources as well, this was just the one that quickest came to mind.

Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @02:31AM (#26911579)
Actually it was, and they had a manager that covered up for them, allowing them to keep working on the project.

"Creating the Go programming language featuring Rob Pike & Robert Griesemer"

https://changelog.com/gotime/100

Had not been for him and Go would never gone beyond a prototype side project.

Re:Green vs. Brown Programming Languages by AnimalMuppet on Friday April 23, 2021 @12:15PM (#26916246)
That isn't what I was claiming, though. I was claiming that the impetus for creating go was the issues raised by working with Google's regular code, not issues raised by working on Rob Pike's pet project at Google. Whether go became their pet project was outside the scope of my claim.
Re:Green vs. Brown Programming Languages by pjmlp on Saturday April 24, 2021 @04:31AM (#26923312)
The only issue was waiting for builds and having to deal with C++ code, something that Pike shares the same opinion as Linus.
Re:Green vs. Brown Programming Languages by gher-shyu3i on Thursday April 22, 2021 @12:10PM (#26904421)
> Go was built explicitly to solve the real everyday problems of working in a large code base, largely driven directly by experience of several industry titans

This claim keeps getting repeated with absolutely nothing to back it up, other than repeating what the golang authors claimed.

I work on a large golang code base, and it's quite horrid. The IDE experience is terrible. It's hard to navigate the code base, due to things like types unintentionally implementing interfaces because they happen to match on some of their function declarations. No proper visibility rules (only "public" and "package private"). interface{} everywhere because of no generics (I'm aware that's being worked on). Single character variable names are popular because the golang authors write code that way and it's seen as "smart". No reserved "this" or "self" keyword to declare methods means that every type will have its own single letter self variable which you have to look up every time. Error handling is terrible, and I've seen many insidious cases of mishandled errors. Null pointers are still a thing. The list goes on.

Edit: not to mention things like the language is against quick prototyping (heavy friction due to things like unnused imports or variables, and a very verbose language), as well as the lack of mature libraries such as JDBI or Dapper.

Re:Green vs. Brown Programming Languages by dragonwriter on Saturday April 24, 2021 @08:48PM (#26929452)
> No reserved "this" or "self" keyword to declare methods means that every type will have its own single letter self variable which you have to look up every time.

Python lacks a reserved keyword for this use, and I can count the ones not using “self” in instance methods and “cls” in class methods that I’ve encountered on the fingers of my left foot.

But, yeah, weak convention plus no keyword promotes needless chaos.

Re:Green vs. Brown Programming Languages by ikiris on Thursday April 22, 2021 @08:39PM (#26909804)
This sounds like really bad code was allowed to be checked in, not the fault of the language. You can make terrible code in almost any language.

The above does not match my experience in maintaining large go codebases because of proper code reviews and expectation of writing maintainable code.

Re:Green vs. Brown Programming Languages by gher-shyu3i on Thursday April 22, 2021 @09:22PM (#26910065)
Nope, we have a very rigorous linting and review process. It's the shortcomings of the language.
Re:Green vs. Brown Programming Languages by ikiris on Friday April 23, 2021 @04:02PM (#26918590)
how are your complaints about your bad variable names shortcomings of the language and not the code you accept?
Re:Green vs. Brown Programming Languages by gher-shyu3i on Friday April 23, 2021 @06:14PM (#26919830)
Because it's literally in the standard library of golang, and everyone copies its style.
Re:Green vs. Brown Programming Languages by majewsky on Friday April 23, 2021 @09:45PM (#26921485)
There is no law that requires the use of the same variable naming style as std. Also,

> interface{} everywhere because of no generics

It would be good to know the domain here. Looking at my own fair share of Go code in productive systems (probably around 100-200 KLOC, written over the last 6 years), interface{} is really really rare. It appears in some library functions which genuinely accept basically any type, in the same way as json.Marshal(), fmt.Printf() or sql.Stmt.Execute() in std.

Other than that, I don't think I've ever had a case where I used interface{} instead of defining a more specific interface (plus adapter types to implement that interface on foreign types if necessary).

The only big mess that I've come across in Go land is kubernetes/client-go. I can't wait for generics to replace this metastasizing heap of autogenerated code.

Re:Green vs. Brown Programming Languages by gher-shyu3i on Saturday April 24, 2021 @07:31AM (#26924129)
> There is no law that requires the use of the same variable naming style as std. Also,

While that's technically true, it doesn't work out in practice because people look to the standard library as "the way" to write golang. It's basically an implied rule and I haven't seen anyone not folllow it so far.

> It would be good to know the domain here

Both infrastructure level work as well as CRUD type work.

> interface{} is really really rare

We have to use them everywhere for things like JSON parsing, config file handling, and pagerduty integration. Not to mention wrappers around SQL handling (e.g. batch inserts, pagination, etc.)

Generics will fix some things in the language, but not all. There are too many issues with it like the ones I already mentioned. It's still a very cludgy language to work with.

Re:Green vs. Brown Programming Languages by majewsky on Sunday April 25, 2021 @01:32PM (#26934591)
> JSON parsing, config file handling

I assume you're not referring to things like json.Marshal(), where the function argument is legitimately of type interface{} since it really accepts any value.

Hence I'm going to assume that you're referring to situations where a value can have one of multiple types (e.g. a float value that sometimes gets provided as a string). It's true that people sometimes unmarshal into interface{} and then type-assert in those scenarios, but that use of interface{} is a code smell that should be flagged in review. The proper way is to unmarshal into a custom type with a json.Unmarshaler implementation that accepts all possible input formats (and vice versa for json.Marshaler if encoding is required). This is a real-world example from one of my codebases: https://github.com/sapcc/limes/blob/d833228e976ac1ddc4b95779...

Re:Green vs. Brown Programming Languages by gher-shyu3i on Wednesday April 28, 2021 @10:11AM (#26969563)
Algebraic types would solve the issue in the example you're giving. However, those don't exist in golang either.
Re:Green vs. Brown Programming Languages by ikiris on Saturday April 24, 2021 @05:10PM (#26928280)
Having worked with the people doing those standard libraries, you're pulling justifications out of your butt for bad practices.

Just as a start: variables names should always be clear by context. You only see the one letter ones if its literally the next line or similar use case. Also, bare interface{} should basically never be the case for a function signature.

None of the code you've described thus far would pass a proper review.

Re:Green vs. Brown Programming Languages by gher-shyu3i on Wednesday April 28, 2021 @10:14AM (#26969590)
Code bases in reality still do what I'm describing, and they pass code reviews. Kubernetes is one example of the atrocities caused by the language.
Re:Green vs. Brown Programming Languages by gameswithgo on Thursday April 22, 2021 @11:29AM (#26903855)
>Go was built explicitly to solve the real everyday problems of working in a large code base, largely driven directly by experience of several industry titans.

So have all languages, with wildly different philosophies about how to do that. We collectively just don't have any idea what we are doing. Clearly nobody has stumbled on a big win or one particular language would start dominating the industry due to the productivity bump.

Re:Green vs. Brown Programming Languages by nemo1618 on Thursday April 22, 2021 @11:47AM (#26904089)
I actually don't think this is true, which is kind of nuts. Programming languages generally fall into two categories:

1) They were either designed by one or two eccentrics, and thus contain a few great guiding principles and many questionable ideas, which invariably come back to bite large projects; or,

2) They were designed by a committee who tried to make the Final Universal Language that would solve every possible problem, resulting in a kitchen-sink mess of a language with a 400-page specification that no one reads.

Most mainstream languages made some attempt to serve software-at-scale; for example, OO used to be the obvious thing that would make software more maintainable, so most languages support it at least in part. But if you look at a language like C++, it's obvious that many of its features were added simply because they were cool or increased expressiveness (e.g. operator overloading) without regard for long-term maintainability. Even things as mundane as "implicit 'this'" are clearly harmful to readability, with specious benefit.

AFAIK, Go is the only language that really takes engineering seriously: https://talks.golang.org/2012/splash.article If there are similar articles for other mainstream languages, I'm certainly curious to read them and see how they hold up today!

Re:Green vs. Brown Programming Languages by monoideism on Thursday April 22, 2021 @07:36PM (#26909422)
> AFAIK, Go is the only language that really takes engineering seriously:

Ada is the consummate engineer's programming language. And with Spark, even more so. Unfortunately, the compilers were super expensive at a critical stage in its evolution. And the DoD thing.

And I've never used Rust professionally (unlike Go), but it has all the applicable points in the article you list (obviously no garbage collection). But in Rust, these features are often implemented in a more robust manner than in Go (eg, like Go, Rust avoids exceptions and uses error values, but instead of returning a special-cased interface, it returns a regular sum type, which allows for proper type checking of the error handling, and which is also composable since it's also a monad). And unlike Go, Rust got package management down from the start. Go's package management has gotten better, but it's still not as good as Rust's through Cargo (to be fair, Cargo is best of class).

Re:Green vs. Brown Programming Languages by gameswithgo on Thursday April 22, 2021 @01:10PM (#26905168)
I think what is actually going on is that Rob Pike's ideas about how software engineering should work resonate strongly with you, while Anders Hejlsberg, Don Syme, James Gosling, Christ Lattner, and Rich Hinkey does not resonate with you.

I think it would be a difficult argument to suggest that those other people do not have similar engineering chops, or haven't been around a long time.

But if you are right we should see Go winning in the marketplace more and more in the future in a way unprecedented for programming languages.

Re:Green vs. Brown Programming Languages by nemo1618 on Thursday April 22, 2021 @02:22PM (#26906114)
I don't mean to suggest that at all -- I have great respect for those people, particularly Rich Hickey, whose framing of "simple" vs "easy" is vital to these discussions. But it's clear that a language like Clojure is not a good fit for million-line, decades-old codebases. Java wasn't explicitly designed for large-scale engineering either; it's north star was Write Once, Run Anywhere. In short, I think there are very few languages that prioritize engineering to the exclusion of other features, and Go is one of them.

Ada is another; it was explicitly designed for large-scale engineering, but hasn't seen nearly as much success as Go. I'd like to learn more about why it failed. Perhaps it was the language itself, or maybe it was merely a timing issue, or the fact that it was backed by the government. This comment has some good info: https://news.ycombinator.com/item?id=7825008

Re:Green vs. Brown Programming Languages by Jtsummers on Thursday April 22, 2021 @03:28PM (#26907068)
Why Ada failed has been discussed ad nauseum including on here. Early compilers were $$,$$$ per seat and proprietary, they're still easily $,$$$ per seat. Good open source compilers came later, there's still a strong disparity between the FOSS and commercial compilers and tooling.

The language was a mandate from US DOD which rubbed a lot of people the wrong way. It largely sat in the same space as Fortran and C, C was free (or much less expensive) and more readily available even when it did cost.

Cosmetic: People strongly dislike the verbosity of Ada. Some parts are reasonable to consider changing (but really are just cosmetic) like begin/end versus {/}. Other verbose portions are hard to change without fundamentally altering the language. You want to print integers and strings and you don't want to have to use Integer'Image(X) all over the place?

  with Text_IO;
  use Text_IO;
  with Ada.Integer_Text_IO;
  use Ada.Integer_Text_IO;
Now Put and Put_Line can be used with both strings and integers. Oh, you want to print more types? More withing for you. I don't mind it, you don't need to print in every package, but it is very cumbersome.

If you want to write a quick CLI tool, Ada is not your language (though I've done it), go for Perl, Python, Ruby, sh/bash, or even Go. C and C++ can be easier for that purpose. But once you start scaling it's a very good language.

The only way to get Ada in the mainstream now is to make it much cheaper and greatly improve the FOSS compilers and tooling, and have SPARK/Ada support an increasingly large subset including approaching feature parity with respect to memory safety as Rust. That's being worked on, but it's a non-trivial problem.

Re:Green vs. Brown Programming Languages by gher-shyu3i on Thursday April 22, 2021 @12:12PM (#26904439)
> https://talks.golang.org/2012/splash.article

The shortcomings listed in that talk are mainly against C and C++. Other serious languages and platforms like Java, C#, and also Rust have solved these issues.

Re:Green vs. Brown Programming Languages by BobbyJo on Thursday April 22, 2021 @11:37AM (#26903967)
>So have all languages, with wildly different philosophies about how to do that.

I think what you refer to as differing philosophies are in fact differing goals, and the goal of Golang is very different from pretty much all other modern languages: simplicity.

I think boiling everything down to 'they are all trying to do it better' misses the fact that the 'it' they are trying to do better is very different in some cases.

Re:Green vs. Brown Programming Languages by gher-shyu3i on Thursday April 22, 2021 @01:20PM (#26905290)
> simplicity

This has to be quantified. Simplicity in the language, perhaps. It definitely does not translate into simplicity of resulting programs, and the ease of being able to reason about them, or write them.

Re:Green vs. Brown Programming Languages by BobbyJo on Thursday April 22, 2021 @06:52PM (#26909091)
Having spent about 3 years each in Java, C++ and Golang, and getting a good amount of time with Python, I have to disagree with your final few points. Golang's simplicity in the spec itself DEFINITELY gives down stream benefits, simplifying a lot more beyond itself. That includes writing and reasoning about code.
Re:Green vs. Brown Programming Languages by gher-shyu3i on Thursday April 22, 2021 @07:52PM (#26909528)
Having worked on several large golang code bases, its verbosity is tedious to deal with. It doesn't lend well to IDEs (e.g. it's so easy for a struct to accidentally implement interfaces it doesn't mean to because of structural typing). Error handling is always a mess, it doesn't have enums, and so many issues to list here that Java doesn't have.

The golang authors' weird obsession with not having any methods on strings for example, makes it horrendous to work with them (e.g. can't chain someString.trim().toUpper().endsWith("...")).

Don't get me started on the supposed fast compile times. Parsing is fast (but so almost any other language that is not C++ or Scala), but linking is horrendously slow. Modifying and re-running individual unit tests takes seconds at a time due to relinking. In Java, it's in a blink of an eye because there is no linking.

Re:Green vs. Brown Programming Languages by BobbyJo on Thursday April 22, 2021 @08:51PM (#26909884)
Having to use functions on built in types like strings.HasSuffix(strings.ToUpper(...)) isn't that bad to me. If I'm chaining a bunch of function calls on a single string, I'll want to separate them on different lines for readability anyway. It'll be creating and destroying a few implicit copies either way, so I have never really felt any pain from that.

Java has no linking, but you have to go through the JVM. Golang produces native binaries. Not really a fair comparison. That being said, my brain is normally a way larger bottle neck than linking time for unit tests.

I'll cede the gripes with enums and error handling (although I hated the way Java exceptions always ended up way too overloaded way more), but I find the typing a really good balance between strong and weak. It's strong enough that you have to be doing something really weird to mess up, but weak enough to be flexible.

Re:Green vs. Brown Programming Languages by gameswithgo on Thursday April 22, 2021 @01:37PM (#26905499)
It is your position that Go is the only language aiming for simplicity? Are you relatively young?
Re:Green vs. Brown Programming Languages by BobbyJo on Thursday April 22, 2021 @06:48PM (#26909057)
No, I don't think it is the only language aiming for simplicity. I do, however, believe it has been the must successful at it.

Young at heart :)

Re:Green vs. Brown Programming Languages by bccdee on Thursday April 22, 2021 @11:44AM (#26904050)
> Clearly nobody has stumbled on a big win or one particular language would start dominating the industry due to the productivity bump.

This is what happened with Python. It provided a distinct productivity advantage over C & C++, and now no one writes web apps in C++ anymore. Granted, it's not just Python anymore, but newer languages learned from Python's success.

Re:Green vs. Brown Programming Languages by jokethrowaway on Thursday April 22, 2021 @08:11PM (#26909628)
First we had web apps written in Java, then Perl, PHP.

Python's popularity for web app development came way later (django was released in 2005)

Re:Green vs. Brown Programming Languages by bccdee on Monday April 26, 2021 @07:07PM (#26949475)
Python was originally written as a reaction to C & C++. It didn't really hit the mainstream for web apps until much later, granted, but when we compare it to the languages it was originally competing against, the difference is pretty clear.
Re:Green vs. Brown Programming Languages by gameswithgo on Thursday April 22, 2021 @01:39PM (#26905525)
Garbage collection got a clear productivity gain over not garbage collection. But it isn't clear that the various takes on GC languages, Python, Java, C#, Go etc have led to any one clear winner.
Re:Green vs. Brown Programming Languages by ska on Thursday April 22, 2021 @06:23PM (#26908876)
> Python, Java, C#,

Notably, we've had garbage collection for nearly as long as we've had programming languages - so this has been going on much longer than the examples you give would suggest.

Re:Green vs. Brown Programming Languages by bccdee on Monday April 26, 2021 @07:03PM (#26949430)
I'd argue that Java ultimately failed to innovate over C++ in the way that Python did. It added GC, but it's still clunky and hard to work with. In that sense, it's more of a pre-Python language, even though it's a few years younger than Python.
Re:Green vs. Brown Programming Languages by michael1999 on Thursday April 22, 2021 @11:45AM (#26904072)
I don't think you mean that, or you misunderstand how Javascript or PHP came to be.
Re:Green vs. Brown Programming Languages by gameswithgo on Thursday April 22, 2021 @01:38PM (#26905510)
If I didn't understand how javascript came to be, I would be suggesting that javascript must be the best language!
Re:Green vs. Brown Programming Languages by jokethrowaway on Thursday April 22, 2021 @08:08PM (#26909611)
From my experience having to debug and fix up / change things in old go codebases, it's an absolute nightmare.

The lack of abstractions often force you to read a lot of code you don't care about.

The language is so simple that reading complex code is actually hard.

Re:Green vs. Brown Programming Languages by tinco on Thursday April 22, 2021 @11:46AM (#26904081)
When Ruby was "hot", it was bringing a lot of new things to the table, things new developers take for granted now.

If you start a new project in typescript, or even C#, you'll get almost all of the things that made Ruby great in 2006.

When I introduce a new developer to Ruby, all I've got to argue in favour of it is that it's a beautifully designed and powerfully expressive language with a library ecosystem chock full of de-facto standardised gems. Relatively vague things, and any newbie can hit me back with its downsides: mediocre performance, no type definitions, and no evented I/O baked into the language.

I do dread the day that I can't start a new project in Ruby, simply because my hiring pool would turn into a mire of people dreading to work on it.

Re:Green vs. Brown Programming Languages by reedjosh on Thursday April 22, 2021 @12:01PM (#26904286)
> mediocre performance, no type definitions, and no evented I/O baked into the language

Ruby 3 addresses each of those issues.

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-rele...

Re:Green vs. Brown Programming Languages by tinco on Thursday April 22, 2021 @12:50PM (#26904938)
Definitely interesting new features, and Ruby is putting up a good fight. But if it was really a ruby feature, and not just something tacked on to stay relevant, that code example would've looked like this:

    require 'async'
    require 'net/http'
    require 'uri'

    ["ruby", "rails", "async"].each.parallel do |topic|
      Net::HTTP.get(URI "https://www.google.com/search?q=#{topic}")
    end
I can't tell someone Ruby is beautiful, and then in the next sentence explain how you need to type Async twice just to get something to run asynchronously.

Same of course for Ruby types, we're just not yet on the point for a truly new way of writing Ruby for Ruby 3. Maybe we'll finally get something like this could be in Ruby 4, but I fear the spectre of backwards incompatibility is going to stand in the way of something that's both truly Ruby and truly in the 2020's.

Re:Green vs. Brown Programming Languages by d3nj4l on Thursday April 22, 2021 @10:00PM (#26910275)
Amen. As a massive ruby fan, I couldn’t put a finger on why I disliked ruby async, but you’ve got it exactly right.
Re:Green vs. Brown Programming Languages by jokethrowaway on Thursday April 22, 2021 @08:16PM (#26909655)
I think the main problem with ruby is that JS has Google v8's performance behind it. Good luck matching that.

Then, if we're talking rails (which is a significant part of the ruby projects out there), there is way too much magic going on.

Magic you have to manually un-peel when something goes wrong.

Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @02:35AM (#26911608)
Actually no.

The way Ruby looks like, it was done in Smalltalk first, with performance, good graphical tooling and developer experience.

If you mean Rails, Zope, AOLServer and Vignette did it first.

Re:Green vs. Brown Programming Languages by tinco on Friday April 23, 2021 @07:07AM (#26913425)
I'm sorry, no. Everyone knows that before Rails there were only three ways to make a web application. You could do it in either PHP, in Java servlets or in ASP.Net. Ok and maybe ColdFusion MX.
Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @08:56AM (#26914258)
Only for souls that only started to do web development after 2002, and never learned about what the world was about between 1994 and 2002.

I can gladly educate you on how Rails did not improve on the stacks already available, rather bring the concepts to a younger generation that never learned about them in first place, starting with ActiveRecord.

Re:Green vs. Brown Programming Languages by tinco on Friday April 23, 2021 @02:00PM (#26917381)
Could you go back and tell 17yr old me know that there's something better than ASP.Net out there? I was doing .Net trying to dodge the Microsoft stack running early versions of Mono and everything, anything to dodge PHP and Java.

I'll gladly receive that education, I have a hard time believing any of those frameworks are as sophisticated today as Rails 2.0 was back in the day.

Re:Green vs. Brown Programming Languages by pjmlp on Saturday April 24, 2021 @04:30AM (#26923303)
You didn't look hard enough, companies like https://www.altitude.com and https://www.outsystems.com were built out of my and others experience with those frameworks.

I could tell how they looked like from startup rooms in little offices spaces in Lisbon back in the early days of .com wave in late 90's, how AOLServer influenced the creation of Intervento's Safelayer framework, or how it got us to be approached by MSFT Portugal for adapting the same ideas to then still alpha version of .NET, however I am the right person to fully tell the story, better let that to the key persons, in case they feel like jumping in.

In any case, here is some education material for yourself,

https://zope.readthedocs.io/en/latest/zopebook/index.html

https://docs.huihoo.com/aolserver/intro/features.html

https://www.linuxjournal.com/article/6164

https://github.com/aolserver/aolserver

Re:Green vs. Brown Programming Languages by nemo1618 on Thursday April 22, 2021 @11:33AM (#26903914)
I think you have this backwards. Go is explicitly optimized for software engineering; in fact, it's the only language I'm aware of that makes large-scale engineering its north star. Here's Rob Pike discussing how Go's design decisions make building and maintaining large programs easier: https://talks.golang.org/2012/splash.article (AFAICT, Rust was not named after "collecting Rust," and long-term maintenance is not one of its primary design goals.)

As an example, one celebrated feature of Go is that "all Go programs looks familiar," i.e. it's easier to get oriented in an unfamiliar Go codebase than just about any other mainstream language. Partly this is due to `gofmt`, but also the fact that the language itself is relatively spartan, with few dark corners. It's an "unsophisticated" language, which obviously cuts both ways.

Rust, by comparison, is a highly complex language. It allows for very powerful abstractions -- as well as very bespoke and "clever" constructs. I think Rust will develop a solid reputation for correctness, much like Haskell; Rust programs will run for many years without bugs or performance issues. But, again like Haskell, Rust will also have a reputation for allowing clever programmers to write too-clever code. That's why Go will prove to be the more maintainable language: because it intentionally limits expressiveness (a highly unpopular decision, unsurprisingly) and thereby limits the amount of "damage" any given programmer can do.

Re:Green vs. Brown Programming Languages by woah on Thursday April 22, 2021 @12:18PM (#26904521)
Go inevitably results in a very large codebase for a given piece of functionality, especially if it’s used alongside Google’s companion projects such as protobufs and grpc. Lack of generics means that it is impossible to generalize over related types, leading to duplicated code, and in some cases, crazy hacks like serializing a struct, passing it through the generic part of the code and then deserializing it again when you need to use it.

Other choices such as structs being initialized with “zero values” in their fields (instead of having a compile error when you forget a field), and the complicated sometimes equivalence of zero values and null create a lot of footguns when refactoring.

Go’s strength is a batteries included stdlib and its looseness can make prototyping faster. But it feels very much like an old school scripting language like php or js, where you have to use countless trivial unit tests to have any confidence about what your code is doing.

Re:Green vs. Brown Programming Languages by Jtsummers on Thursday April 22, 2021 @12:10PM (#26904423)
> [Go]'s the only language I'm aware of that makes large-scale engineering its north star.

Ada, Eiffel, Java, Pascal and derivatives, C#, Rust. Probably many others but I'd argue outside of tooling (which Go is particularly good at and has done an incredible job of standardizing, Rust being a peer in that regard with cargo) these languages are as good or better than Go for software engineering.

Re:Green vs. Brown Programming Languages by nemo1618 on Thursday April 22, 2021 @12:48PM (#26904910)
By "north star" I mean the guiding principle that other aspects are sacrificed for. A heuristic might be: "[Lang] would not be [lang] without [aspect]."

I'm sure that the Rust team wants Rust to be a good language for large-scale engineering, but it's not their north star; "fearless concurrency" is probably the closest. For example, Rust is willing to sacrifice simple syntax and fast compile times to achieve more safety; Go is not.

I don't know enough about the other languages to speak confidently about them, but if you can point me to any source materials (i.e. articles or talks by the language creators) that discuss large-scale engineering, I'd be interested to read them!

Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @02:38AM (#26911633)
https://www.amazon.com/Eiffel-Language-PRENTICE-HALL-OBJECT-...

> Quickly emerging as the language of choice for developers of quality software, this guide explains how the Eiffel language combines rigorous software engineering principles with advanced object-oriented techniques. It reveals the simplicity, consistency, and blend of various powerful mechanisms in Eiffel, including: an object-oriented structure based on classes ; multiple and repeated inheritance information hiding assertions to guarantee, document, and test the correctness of software components; strong typing backed by support for generic classes; dynamic binding a highly dynamic run-time model supporting garbage collection renaming and redefinition facilities . . . disciplined exception handling and support for persistent objects. As both an implementation language and a high-level notation for analysis and design, Eiffel emphasizes the industrial production of reusable software components. Written for software designers, analysts, and programmers.

https://www.eiffel.com/

Re:Green vs. Brown Programming Languages by kbenson on Thursday April 22, 2021 @01:23PM (#26905322)
> it's not their north star; "fearless concurrency" is probably the closest.

That's just a more recent slogan to succinctly express what their real north star means. Their real north star is "safety and correctness", and like all languages, they push to make the most important thing to them easy and approachable.

Here's the thing, I'm not sure as a project saying your focus is large scale engineering and pushing towards that actually gets you closer to the desired result in the end than pushing for safety and correctness instead. I could fully see a language that pushes for safety and correctness eventually being a much better and easier to use choice when evaluating with respect to large scale engineering, because those are extremely important to large scale engineering.

Re:Green vs. Brown Programming Languages by nemo1618 on Thursday April 22, 2021 @02:04PM (#26905844)
Safety and correctness certainly are important -- but they're also orthogonal to maintainability (among other values)!

It's good to have most of the core values in common, but a language's guiding principle manifests in many small ways that can be very compelling in aggregate. Go's weird capital-letter namespace visibility rule is a great example of this: it has nothing to do with safety or correctness, but it's enormously helpful for getting your bearings in unfamiliar code, because it localizes an important piece of information, saving you a context-switch. Sure, another language might hit upon this feature incidentally (Rust has conventions around capitalization, and IIRC Haskell enforces it to some degree), but how many languages will chance upon all of the little things that make for a great engineering language?

Re:Green vs. Brown Programming Languages by Jtsummers on Thursday April 22, 2021 @03:06PM (#26906805)
I keep writing poor tutorials (due to space) of Ada here. Check out https://learn.adacore.com/ for more.

Overall I like Go, but for software engineering in the large Ada, in contrast to Go, has:

Explicit separation of specification and implementation of packages and types making it easier to shard the work out to numerous individuals and teams.

What a package exports is explicit, not the result of case conventions.

  package Foo is
    procedure Bar(N : in Integer); -- exported
  private
    procedure Baz(N : out Integer); -- unexported
  end Foo;

  package body Foo is
    -- implementations of the above
  end Foo;
Generics from day 1, which enabled a set of collection packages similar to C++'s STL in Ada 2005 among other things.

Tasks, similar to Go's goroutines, but have a lot of additional guarantees and behaviors that have to be made explicit in Go.

Protected objects and protected types which permit you to write code without explicitly acquiring/releases mutexes and using condition variables.

Design-by-contract with SPARK/Ada becoming a proper subset of Ada in Ada 2012.

Re:Green vs. Brown Programming Languages by kbenson on Thursday April 22, 2021 @03:46PM (#26907310)
> but they're also orthogonal to maintainability

Not entirely. Some amount of maintainability is fixing mistakes that result in less correct or safe programs. By reducing occurrences of these classes of problems later, you're reducing the maintainability burden.

It's the same thing that makes a language with a type system more maintainable in the long run. Eliminating classes of errors pays dividends later. The decision to make is whether the extra effort at the time of creation is worth that reduction. Depending on the type of software, it's expected lifetime, and how many people are expected to use it, that may differ. For large scale engineering, I imagine the extra effort required up front is almost always worth it.

Re:Green vs. Brown Programming Languages by brson on Thursday April 22, 2021 @06:27PM (#26908908)
Rust was explicitly designed from the beginning for creating maintainable large-scale software.

Here's the original elevator pitch from 2010:

https://github.com/rust-lang/rust/blob/d6b7c96c3eb29b9244ece...

Note the text about "programming in the large".

Re:Green vs. Brown Programming Languages by alricb on Thursday April 22, 2021 @11:42AM (#26904024)
Eiffel might be another.
Re:Green vs. Brown Programming Languages by nemo1618 on Thursday April 22, 2021 @11:49AM (#26904118)
I don't know much about Eiffel; do you know of any articles or talks that discuss its design tradeoffs?
Re:Green vs. Brown Programming Languages by Jtsummers on Thursday April 22, 2021 @12:36PM (#26904742)
Eiffel's bigger contributions are probably:

Design-by-contract. The contracts aren't just comments, they aren't haphazardly enforced by adding asserts to the code. They're explicit parts of the language which allows for a lot of interesting consequences when utilized. Testing can be semi-automated directly from the code, some elements of the program design can be proved to be satisfied statically without the need for compilation and execution. The ability to encode your specification into the language is incredibly useful.

Command-query separation. If methods return a value (queries) they should be referentially transparent, having no side effects. This is a principle so not an explicit language feature, but it can be enforced using DbC.

Re:Green vs. Brown Programming Languages by gher-shyu3i on Thursday April 22, 2021 @12:16PM (#26904501)
> Go is explicitly optimized for software engineering;

There's nothing to back up this claim. Using golang in practice shows otherwise. The mess resulting in large code bases is much more difficult to deal with compared to Java for instance.

Re:Green vs. Brown Programming Languages by titzer on Thursday April 22, 2021 @11:13AM (#26903650)
I predict exactly the opposite.

Baking ownership into the type system makes API design and refactoring hard, while having GC makes memory management entirely orthogonal and easy to change. Go is already over 10 years old and designed by people who have worked on software for 30, sometimes 40, years. Go changes slowly and Rust is still evolving.

Re:Green vs. Brown Programming Languages by gpm on Thursday April 22, 2021 @11:23AM (#26903779)
> and refactoring hard

The opposite, it makes refactoring really easy, because it's so hard to screw up mechanical changes.

The memory management aspect of refactoring is slightly more tedius in rust (compared to go), because you have to update lifetime annotations sometimes. This is a mechanical process and not hard. The trade off is that the existence of lifetimes and ownerships means that many of the rest of refactoring tasks (getting locks right, not introducing data races, making sure you're not doing something dumb like accessing a freed fd, etc) are much simpler.

Rust is also better than go at refactoring because go's ducktyping (and reflection) means that there is frequently action at a distance that is hard to track down. Changing the name of a field of a struct can change behavior in another file that never mentions the field by name.

Go is in the middle of adding generics to the language, I don't think Rust has made a change of that magnitude since it hit 1.0...

Re:Green vs. Brown Programming Languages by rowchain on Thursday April 22, 2021 @11:45AM (#26904067)
> The memory management aspect of refactoring is slightly more tedius in rust (compared to go), because you have to update lifetime annotations sometimes.

It is much more complicated. You sometimes have to implement clone, pin/project, box etc to satisfy new trait bounds for example. Also, build times can make refactoring and iterating really painful.

I like and use both languages; I think they are complimentary, and I think things need to be weighted more honestly than what I see in this discussion.

Re:Green vs. Brown Programming Languages by titzer on Thursday April 22, 2021 @11:54AM (#26904202)
I am by no means a Golang developer, so don't construe my OP to be a particular endorsement of Go. But after 25 years writing C/C++, Java, Javascript, and working on language implementations, garbage collectors, JITs, VMs--what most people consider "system software"--I feel strongly that requiring programmers to reason about ownership for memory management is a complete waste of everyone's time. It's more mental load than programmers should not be burdened with, no matter how good the tools for it are. The performance costs of GC are routinely overstated by C/C++/Rust advocates to the point that GC implementation experts have pretty much become cut off from the conversation. No one really measures properly, anyway.

My honest opinion is that it is 2021 and it's about time we let computers manage memory already.

Rust can have their ownership for race conditions if they want, but I am so tired of being gaslighted about how important it is that I be hounded to track every solitary byte of memory when I am busy thinking about more important things.

Re:Green vs. Brown Programming Languages by zozbot234 on Thursday April 22, 2021 @12:31PM (#26904688)
> I feel strongly that requiring programmers to reason about ownership for memory management is a complete waste of everyone's time. It's more mental load than programmers should not be burdened with, no matter how good the tools for it are.

On the contrary, ownership tracking is important for general code correctness, not just memory management. It's practically impossible to audit and assess correctness of a program with pervasive confusion in the overall patterns of what code owns what data. Memory safety is also important of course, but it's mere table stakes.

Re:Green vs. Brown Programming Languages by sixbrx on Thursday April 22, 2021 @02:45PM (#26906482)
I agree, ownership is an important idea on its own. So I wish more mainstream gc languages would expose some kind of optional ownership idea. Such as ability to "give" a collection to another collection contructor, which then would not have to do a boilerplatey/inefficient "safe-copy" in the contructor. Maybe that opens a can of worms and can't be easily retrofitted into existing languages, I don't know, but I'd like to see it tried.
Re:Green vs. Brown Programming Languages by steveklabnik on Thursday April 22, 2021 @12:06PM (#26904361)
This is why this subject is hard to talk about. I fully agree that humans shouldn't have to care about memory management! That's why Rust is so important: the compiler thinks about it so that I don't have to. People can even agree on the main points and completely disagree on the conclusions.
Re:Green vs. Brown Programming Languages by titzer on Thursday April 22, 2021 @03:26PM (#26907043)
Unfortunately the space is littered with confounding variables. For example, just measuring the impact of GC overhead is bound to be tricky, because a trashy program (one that allocates a lot of garbage) is going to make GC look bad in comparison to a program that is careful to reuse data structures. And that's mostly because of the second-order effects of the memory hierarchy, and not so much about the raw cost of allocation or deallocation! A lot of language library choices contribute to trashiness; e.g. in Java it is very difficult to avoid making lots garbage if you use essentially any of the JDK. You can't even parse integers or strings effectively without multiple copies. I really don't know how Go's libraries look in that regard, but the truism generally holds that the more bullet-proof you try to make APIs, the more defensive copies you end up making.

Is the antidote to those inefficiencies an ownership model that forces you to reason about mutability? I don't know. I kind of think no, primarily that it is a performance consideration that infects the API and spreads everywhere; it's a distraction. Is it instead to have all immutable data structures and an insanely smart compiler that replaces copying with in-place mutation, so that pure functional languages compete with highly tuned, pervasively mutable code? I kind of also think, no. And primarily that's because performance cliffs get worse and harder to predict, the smarter your compiler is.

The mutability/ownership question is confounded with allocation and deallocation. The latter really should never be on any programmer's mind, IMHO. In Rust, it seems there isn't much support for decoupling the two, e.g. by having an automatic garbage collector. That's also an unfortunate reality forced on language implementers by the fact that LLVM has steadfastly refused to support stackmaps as a first class concept for more than 15 years. Many, many projects have died because of LLVM's stackmap support being lacking or broken. That's unfortunate because precise stackmaps are a key enabler for many GC techniques, and without them, you end up with some form of conservatism that make certain optimizations impossible, and forces a particular design for nurseries.

Re:Green vs. Brown Programming Languages by steveklabnik on Thursday April 22, 2021 @03:37PM (#26907183)
Yeah, you have to get into all of these details to have a productive conversation. Likewise, I don't actually think a lot of this inherently has to do with performance, basically, I could make a similarly lengthy comment about how

> I kind of think no, primarily that it is a performance consideration that infects the API and spreads everywhere; it's a distraction.

is something I fundamentally disagree with; unfortunately, I don't really have the time at this moment to even get it into the level that you have here, but it's a good conversation to have, and a needed level of details to even have a good conversation.

Re:Green vs. Brown Programming Languages by brundolf on Thursday April 22, 2021 @04:31PM (#26907799)
Seconding the disagreement with the idea that mutability tracking is a distraction. I would give anything to have true deep-immutability enforced by TypeScript, but unfortunately the language semantics make it virtually impossible. In Rust, it might be my favorite feature.
Re:Green vs. Brown Programming Languages by titzer on Thursday April 22, 2021 @03:47PM (#26907318)
Interesting. We definitely should have this conversation in the proper detail, because my estimates of Rust's language design priorities must be off.
Re:Green vs. Brown Programming Languages by imtringued on Friday April 23, 2021 @11:42AM (#26915881)
>For example, just measuring the impact of GC overhead is bound to be tricky, because a trashy program (one that allocates a lot of garbage) is going to make GC look bad in comparison to a program that is careful to reuse data structures.

This is completely irrelevant because stop the world pauses are global and affect your entire application no matter how careful you write your code. Every library you use has to be carefully written, every single line of code you write has to be carefully written regardless of whether it is time critical or not, this is a complete dead weight for the entire application.

With isolated GC heaps your time critical code will be isolated from non critical code. In practice the easiest way to do this is to just launch a separate application. This hurts a lot with the JVM because it wants to own your entire server (mostly RAM) for some inexplicable reason and you might as well write that part in C++ if you do inter process communication anyway.

Re:Green vs. Brown Programming Languages by zozbot234 on Friday April 23, 2021 @09:33AM (#26914574)
Thing is, in order to have pervasive reuse of data structures (mitigating the overhead of GC) while maintaining safety and correctness, you have to track uniqueness and mutability throughout the program. At that point, you've got something that's practically indistinguishable from borrowck.

The real use case for GC is managing data where there's no well-defined "ownership" pattern, such as when dealing with general graphs (e.g. in a symbolic computing or GOFAI application). That's a remarkably niche domain.

Re:Green vs. Brown Programming Languages by jokethrowaway on Thursday April 22, 2021 @08:24PM (#26909700)
I don't write software at fang scale and I've been bitten by GC pauses in other languages. Even when it doesn't cause issues, you can see it in the response times charts.

Not having to worry about that is very nice. Using less memory, I agree it's not terribly important but it is a nice bonus - which comes in handy when working on embedded, videogames or in constrained conditions (like when you can put a lower limit to your containers and run more containers on the same machine).

Re:Green vs. Brown Programming Languages by tene on Thursday April 22, 2021 @04:00PM (#26907458)
My main objection to this take is that ownership is about far more than just memory management.

Garbage collection lets you avoid memory leaks, double-free, use-after-free, and that's it. In Go, it's up to you to correctly handle every other type of resource correctly, as the compiler won't offer you any help.

An ownership system like Rust's is a general-purpose tool that handles all kinds of resource management. File descriptors, database transactions, session types, locks, etc.

People praise Go's channels, but Go channels are way more complicated to use correctly, and part of that is due to ambient ownership (the other part is due to bad error handling). You need to manually keep separate track of how many outstanding writers there are are, and then explicitly close the channel. In Rust, the channel is closed when all senders or all receivers are dropped. I don't have to do anything, and it's always as correct as what I'd have to implement and maintain myself in Go.

Another great example is how Rust's mutex can own the guarded value. In most languages, a mutex is a separate object, and it's up to you to be careful to make sure you never access it without acquiring the mutex first, to always release after the last use of the guarded value, and to never keep a reference to the guarded value after releasing the mutex.

With Rust, the ownership system is used to handle and verify all of that, so I do less work, have less to think about it, and can't make those mistakes. The Mutex owns the value. Mutex::lock() and ::try_lock() return a guard that you dereference to access the protected value. The mutex is released when the guard is dropped. The guard borrows from the mutex, so any attempt to keep it around longer than you have access to the mutex is flagged by the compiler.

My honest opinion is that it is 2021 and it's about time we let computers manage all of our resources, instead of only memory.

Addressing the last part of your comment, that doesn't sound like my experiences writing Rust at all. Regarding memory management and ownership, the majority of the code I write in Rust, I just type the obvious thing and it just works. The majority of the remainder, the compiler points out that I've done something dumb, and it's a trivial fix. The rest of the time, I'm trying to do something genuinely complicated, and the compiler helps me figure out and verify the work in pieces, rather than trying to cram the whole thing in my head at once, and then convince myself that it's correct. When I'm finished, I feel confident that the compiler will catch errors introduced by future maintenance and refactoring, rather than having to cram it all back into my brain at once every time I touch the code.

To me, in both Rust and Go, the trivial cases are trivial. For more-interesting cases, Rust lets me just do the thing and focus on thinking about my problem at a higher level while trusting that the compiler will handle the details. For more-interesting cases with Go, I have to keep track of a bunch of little details and make sure I explicitly clean up every little resource I ever interact with.

Re:Green vs. Brown Programming Languages by tene on Thursday April 22, 2021 @04:12PM (#26907585)
Having said all of that, I do agree that there are many programs where Rust's defaults don't add a lot of value, and it would be nice to have access to shared garbage-collected data without the syntax overhead of Arc<Mutex<T>> or crossbeam_epoch.

I really like the discussion on resource types vs data types in this essay on higher-level rust-inspired languages: https://without.boats/blog/revisiting-a-smaller-rust/

Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @02:43AM (#26911687)
This has been solved since Common Lisp using resource managment macros and similar approaches used by modern lacks.

What Go defer lacks, is the ability like e.g. .NET with IDispose, where I can make of Roslyn Analyzers to break builds when I forget to call using on such resources.

Rust is a good option for kernel code and drivers, beyond that there is no point in throwing away the productivity of having a GC around.

Re:Green vs. Brown Programming Languages by imtringued on Friday April 23, 2021 @11:33AM (#26915767)
You could have your cake and eat it too if languages with multiple GC heaps had become popular, as it is right now 99% of programming languages have one global heap and that means global pauses from which you cannot escape from. A lot of the time when someone wants to write real time code they just want that tiny little nugget to run without the GC, usually it can be confined to a single thread or maybe a separate pool of threads each with their own heaps while the rest of the application happily uses a global heap.

The fact that you haven't mentioned these low hanging fruit makes me feel like you haven't thought your argument through. You're advocating for a half baked solution even though there is a perfect solution that almost nobody tapped into that would make the GC superior almost everywhere. That's why you are wrong and why nobody should listen to you and people should listen to the creators of Erlang and Ponylang instead.

Re:Green vs. Brown Programming Languages by spacechild1 on Friday April 23, 2021 @08:57AM (#26914272)
> My honest opinion is that it is 2021 and it's about time we let computers manage memory already.

In the field where I am working (realtime audio), that is just not possible. I don't want to have a garbage collector pause in the audio thread. In fact, I can't do any dynamic memory allocations at all (without a special realtime memory allocator). Other fields, like medical devices, flight control, embedded systems, etc. have even tighter constraints.

Manual memory management is not only about performance, but also about predictability. This kind of low level control is one of the main reasons why people use C/C++ in the first place.

Re:Green vs. Brown Programming Languages by seer on Friday April 23, 2021 @01:19AM (#26911221)
> Changing the name of a field of a struct can change behavior in another file that never mentions the field by name.

I don’t code in go so this looked surprising to me. TypeScript has a similar feature regarding types, and it will tell you if you change a field in a record, and that record is actually used in a place where another record with the same fields is asked for.

Kind of surprised go has this problem.

Re:Green vs. Brown Programming Languages by gpm on Friday April 23, 2021 @11:21AM (#26915651)
Difference cause of a similar issue. A fair bit of go code relies on reflection to list the fields of a struct and decide what to do, so e.g. if you change the name of a field in a struct and you happened to be serializing the struct somewhere else the serialization will change even though nothing near to the name change suggested that the struct was ever being serialized in the first place.

Apart from serialization I've also seen this with ORMs, and some of internal code for metrics. I imagine there are other cases too... but while I currently work in go I'm not really that much of an expert in the language.

Re:Green vs. Brown Programming Languages by kaba0 on Thursday April 22, 2021 @11:30AM (#26903872)
And in what aspect is Go a better than the million other language with GC? Like, it is C level bad at expressivity, way too verbose because hardly any abstraction can be made there. Concurrency is the only thing going for it.

But how is it any better than Java or C#?

And Rust is a low level language, so it has to get away with rare cases where a GC is not applicable. And being low level of course imposes the memory layout of the program on APIs as well, but that is a known trade off when one goes low level.

Re:Green vs. Brown Programming Languages by guscost on Thursday April 22, 2021 @11:21AM (#26903745)
If your opinion is as simple as “Go will be more better than Rust”, or the opposite, it is far too simple to be correct.

Rust is unbeatable for services you want to deploy, stabilize, and forget about forever.

Go is pretty darn good for building out complicated/messy services in an iterative process.

Re:Green vs. Brown Programming Languages by throwaway09223 on Thursday April 22, 2021 @11:27AM (#26903832)
Go is the optimal language for a company that wants one (or more) microservice per engineer. It's a great language for padding out bulletpoints for a promo packet.
Re:Green vs. Brown Programming Languages by dnautics on Thursday April 22, 2021 @12:47PM (#26904904)
> Rust is unbeatable for services you want to deploy, stabilize, and forget about forever.

Erlang.

Re:Green vs. Brown Programming Languages by guscost on Thursday April 22, 2021 @09:41PM (#26910161)
More expensive, and not always necessary. But great point.
Re:Green vs. Brown Programming Languages by dnautics on Friday April 23, 2021 @03:21AM (#26911988)
You will never have a stabilized system unless you are multinode. Hardware will fail. Rust is not good at this.
Re:Green vs. Brown Programming Languages by afiori on Thursday April 22, 2021 @11:28AM (#26903844)
GC and tracking ownership are orthogonal; the lifetimes of GC references and normal references would be different, but rust could perfectly well have a GC by default
Re:Green vs. Brown Programming Languages by simiones on Thursday April 22, 2021 @12:46PM (#26904886)
It could, but it won't. If we're talking about real-world use, this makes all the difference.

C or C++ could have a GC as well (in fact, they do - you can use Boehm for any C or C++ program), but there are approximately 0 programs that do.

Re:Green vs. Brown Programming Languages by pjmlp on Friday April 23, 2021 @02:45AM (#26911710)
C++/CLI, C++/CX and Unreal C++ are example of C++ programs that do use some form of GC, just not Boehm.
Re:Green vs. Brown Programming Languages by simiones on Monday April 26, 2021 @08:57AM (#26942022)
I didn't know about Unreal C++ using a GC, but the others have extremely little use. So little, that C++/CLR (at the time) had a bug for at least 2 years where doing something like initializing a CLR List (CLR, not std::) with an initializer list (I have forgotten the exact syntax, but it is similar to `auto lst = new List<int>{a, b}`) would allocate millions of elements on the heap (if I remember correctly, it would create a List of size 0xC0FFEE, or maybe it was 0xDEADBEEF - either way, obvious debug code, then set list[0]=a and list[1]=b).
Re:Green vs. Brown Programming Languages by geodel on Thursday April 22, 2021 @08:36PM (#26909784)
> I think Go is in a honeymoon phase and people will hate it in 10 years; ..

I wrote some Go code for talking LDAPs and doing some CRUD Ops. Do I love this code? Nope. Do I love the product that I built? Very Much.

I think love of language is somehow very much a Rust thing at least compared to Go.

> Rust on the other hand is optimized for maintaining

This seems to be a tall claim. So often in Rust some or other library, web framework goes defunct or abandoned. And they are not exactly in finished state so no maintenance is required. Same thing happens with other languages too. But Rust is quite young, even then we have abandoned projects. In 10 years I am not sure how Rust codebases will be more maintained not less. Now one can say maintenance point is about commercial projects where people are paid to maintain. Still then not sure how loved it would be by maintainers when original developers are long gone.

Re:Green vs. Brown Programming Languages by pojntfx on Thursday April 22, 2021 @12:00PM (#26904273)
I have to disagree with this. I'd even argue that the direct opposite is the case: Go is so conservative in it's decisions, it's hard to find a project from years ago which doesn't "just work" with `go run`. The syntax and semantics are very simple and tend not to change much/haven't really changed since the initial release, which is definitely not the case with Rust, where stuff moves really quickly (not a bad thing by definition, but IMHO not the best for maintaining an already existing project)
Re:Green vs. Brown Programming Languages by srparish on Thursday April 22, 2021 @04:00PM (#26907459)
> it's hard to find a project from years ago which doesn't "just work" with `go run`

That's not been my experience. On a team I was on, even code from six months prior would sometimes be difficult to compile. They keep changing how GOPRIVATE works, or how modules work, or how vendoring works with modules.

Re:Green vs. Brown Programming Languages by carols10cents on Thursday April 22, 2021 @06:30PM (#26908931)
Rust takes backwards compatibility very seriously; if you ever come across a Rust project that doesn't build with the latest compiler, please file a bug.
Re:Green vs. Brown Programming Languages by bakatubas on Thursday April 22, 2021 @12:15PM (#26904480)
I think that is true regarding language popularity—but not their viability for intended purpose.

Perl is a great example because although it has its quirks and the ecosystem shows some age, there really isn’t anything like Perl. It is a very good language for interacting in the console and with data of many types. It’s $_ variable which is based on implied context (much like in language we short-form speech when context is implied). Those are features something like rust (or go) simply isn’t designed for.

Hell, people still use and enjoy programming in C or Basic or Pascal. They just aren’t “popular” because developers are eager to put their comp-sci to use and invent more languages :)

Re:Green vs. Brown Programming Languages by JulianMorrison on Thursday April 22, 2021 @11:51AM (#26904152)
Go thinks that having a simple language, one way to do a thing, standard formatting, low boilerplate, and coupling minimised using interfaces and explicit exports all adds up to maintainability. Time will tell if it's right.
Re:Green vs. Brown Programming Languages by stouset on Thursday April 22, 2021 @12:35PM (#26904730)
Two of those in particular are what the overwhelming majority of detractors find issue with.

A “simple” language frequently offloads more work onto its users. In my experience with golang, this is true. Meaningful abstraction is punished or impossible, so every solution to every problem—no matter how many times it’s been solved before—becomes a computer science exercise where every detail has to be dealt with and remains on full display. Reading golang is a chore because you can’t zoom out and look at the high-level flow, it’s only low-level minutiae at every level of the code. It’d be like an architect having to write the molecular layout of a skyscraper into the blueprints. Chemical formulae everywhere but no picture of walls, floors, or a building anywhere to be found.

Second, claiming golang has “low boilerplate” is the programming language equivalent of Stockholm syndrome. Look up any popular project. Something like fifty percent is

    if res, err := func(…); err != nil {
        return nil, fmt.Errorf(“Look ma, I’m a human exception handler: %w”, err)
    }
That’s not an exaggeration. 50% seems to be the trend from the projects I’ve sampled. It actually makes it frustratingly difficult to follow what a function is supposed to do because the logic is lost in a sea of nearly-identical error handling. Spotting a bug in one stanza of code that’s in a sequence of nearly-identical visual blocks is hard because your brain starts glossing over the details that are repeated.
Re:Green vs. Brown Programming Languages by Seb-C on Thursday April 22, 2021 @10:58PM (#26910558)
I wish there was a standard one-liner pattern to handle errors, that would improve it a bit visually.

Go has a LOT of boilerplate. And that is why I love it. No magic. No implicit behavior. No weird stuff that will bite me if I don't know that something in a completely unrelated file is changing the behavior of my code.

It allows me to write high quality code and care about all the millions of details I should be thinking about.

Yes, 50% of go code is about handling specific cases and errors. And that's a good thing, because unexpected cases and error handling is 50% of the work that a developer should be doing. But often it is just neglected or difficult to spot in other languages (until it bites you).

Re:Green vs. Brown Programming Languages by JulianMorrison on Friday April 23, 2021 @12:01PM (#26916116)
I guess I should explain why I think Go has low boilerplate. It does have "explicit everything" and I love that too. Also no "spooky action at a distance", like redefined operators. Things do what they say and say what they mean.

What it doesn't have is a lot of noise basically intended to keep the compiler happy, or implement common indirection patterns. Types are generally simple and can often be omitted. It's not traditional OO, so a lot of needless abstraction can be skipped. Complying with interfaces just means providing the required methods. Go code compared with the equivalent C or Java is denser.

For what it's worth there was an attempt at improving errors, which would have added a keyword that means "do this, or if it fails return the error result in this function's error result". I liked that idea. I'm not sure why it wasn't well received, but they evidently have that on their to-do list.

Re:Green vs. Brown Programming Languages by benreesman on Thursday April 22, 2021 @11:42AM (#26904023)
There was this wonderful 6-8 year period after every thread on programming stopped being dominated by Ruby advocacy and before it started up with Rust.

Why cram a Rust advocacy soundbite into a thread about maintenance vs. prototyping?

Re:Green vs. Brown Programming Languages by mohanmcgeek on Saturday April 24, 2021 @01:50AM (#26922581)
Coincidentally it's all those Ruby people who are high profile Rust people.
Re:Green vs. Brown Programming Languages by bradleyjg on Thursday April 22, 2021 @11:13AM (#26903656)
I don’t know that people love ada and it was designed with the same goals in mind.
Re:Green vs. Brown Programming Languages by megameter on Thursday April 22, 2021 @02:45PM (#26906477)
I can confidently predict that both Go and Rust will be seen as the "old brown stuff" in not so many years and some hot new thing will have come along that everyone wants to build in.

Rust's main claim to fame - safe manual memory - is already being re-examined. There is definitely interest in and pursuit of a lower-boilerplate means of getting the same, and there are some candidates out there already.

Further, a language being successfully used by experts and popularized tends to precede an accumulation of low quality contributions that negate base improvements to maintenance. In due course, a popular Rust will become "enterprised" with an accretion of tooling and frameworks - although it might not look the same as "enterprise Java", it will have the same kinds of effects in creating barriers to entry and sucking the sense of "fun" out of the day-to-day workflow.

Lastly, the application categories will change. There will be demand for "glue" again, applications that are just frontends to library code(perhaps code written in Go or Rust). The new language will be something not systems-focused, and perhaps aim to be mostly focused on content and presentation (as HTML was in inception).

Re:Green vs. Brown Programming Languages by aw1621107 on Friday April 23, 2021 @01:08PM (#26916832)
> There is definitely interest in and pursuit of a lower-boilerplate means of getting the same, and there are some candidates out there already.

What are some of those candidates?

Re:Green vs. Brown Programming Languages by _james_33_22__ on Thursday April 22, 2021 @11:26PM (#26910679)
Oh my, here we go again: The first post on a general language thread is bashing Go and hyping Rust ... that in itself is a very sad and problematic story as some inexperienced devs fall into the trap of this kind of promotion that Rust is the silver bullet for all kind of applications / projects. Rust has it's place. Go has it's place. Java has it's place. There's so much more than pure language feature for successful projects. The language is not even in the top 3.

But more importantly I disagree to your actual assessment:

Go code is very easy to read and understand. You're at the core of the problem at hand at once. No over abstractions or complex syntax or complex language features. Go has very few quirks (every language has them, people thinking "their" language is free of them are just being ignorant). I found very few real world issues caused by language quirks in Go production code (just as with Java or .NET).

Much more important for quality code are engineering decisions, structure and processes. As Go is easy to write, read and understand it leaves more mental capacity to those often underrated areas.

Go is a memory managed language. That alone makes it much easier to understand and maintain than every other language where you need to do it yourself. Again, more room for engineering decisions.

As Go has a very large and extremely useful standard lib you have much less issues with unmaintained third party libs. Imaging a large Rust codebase and all it's dependencies to one-person-maintained libs. A maintenance nightmare thinking 10 years ahead.

Just look at some good quality Go code, e.g. Hugo https://github.com/gohugoio/hugo/blob/master/navigation/menu... I've picked an arbitrary file. There might be issues in it, but look how easy to read and understand it is.

Regarding Rust: I have no general interest in talking bad about it, but need to make a point. Just as a real world reminder think of the Actix story. One part is the unsafe issue. How many people in the world would be able to understand the actual code and could have cleaned it up? Maybe 50? Fortunately there was a happy end. But how much time and energy did it take to get it on track again? What if Actix had not been the most popular and known framework?

All our companies Go servers (still mostly Java apps) are build with the standard lib. One thing less to worry about in the long run.

Re:Green vs. Brown Programming Languages by emodendroket on Thursday April 22, 2021 @12:10PM (#26904410)
I feel the opposite way about Go. Reading other people's code is relatively easy but the tedium of writing it can be draining.
Re:Green vs. Brown Programming Languages by foolfoolz on Thursday April 22, 2021 @11:09AM (#26903616)
this sounds entirely like personal preference based on the projects you’ve worked with. all languages are capable of producing maintainable software. it’s much more about the authors skill than the language itself. yes statically typed languages scale better, but ide support on dynamic languages is still good. i don’t buy the “rust solves all problems” idea. that is the hype curve
Re:Green vs. Brown Programming Languages by tpm on Thursday April 22, 2021 @11:19AM (#26903722)
For projects with a large number of contributors and long development time there will inevitably be some less maintainable code and that is where the quality of the language itself will become important.

No language solves all problems obviously, but clearly some are better than others in nthat regard. I have no experience in Rust but many years with Perl and Java (and others). Perl in the hands of a small, very experienced team had the highest productivity and quality I have seen - but I would not want use Perl in a project with higher developer churn and lots of inexperienced coders.

Re:Green vs. Brown Programming Languages by athenot on Thursday April 22, 2021 @11:38AM (#26903981)
> Perl in the hands of a small, very experienced team had the highest productivity and quality I have seen - but I would not want use Perl in a project with higher developer churn and lots of inexperienced coders.

This has been my experience as well.

I think that's why "medium powered" languages such as Python and Java tend to get the widest adoption over time. They are less expressive but also have fewer gotchas, and in a team of 100s or 1000s of good-but-not-stellar developers who come and go, they end up being the least painful for the organization.

Re:Green vs. Brown Programming Languages by oblio on Thursday April 22, 2021 @01:07PM (#26905135)
In discussions about programming languages, you have to always remember to add "equally"/"to the same degree" to statements such as this one:

> all languages are capable of producing maintainable software

Once you add that, you understand what the original poster actually meant.

Re:Green vs. Brown Programming Languages by citrin_ru on Thursday April 22, 2021 @11:29AM (#26903850)
I agree that it is possible to write maintainable code in any language and it is possible to make a mess in any language too. But some languages to some extent trying to force this, which may move an average project, even if only a little, to more maintainable shape.

Examples of such languages are Go and Python: both to some extent enforce code formatting - Python with indentation being part of the syntax, Go with gofmt being almost universally used tool. Both try to maintain one preferred way to do things - opposite to "There's more than one way to do it" in Perl.

Re:Green vs. Brown Programming Languages by obviouslynotme on Thursday April 22, 2021 @03:34PM (#26907137)
Rust doesn't add anything that increases maintainability beyond memory safety. This is nice, but it's not even 1% of what maintenance work looks like. Maintaining a decades old code base means adding features without blowing up the beast. This involves: (1) digging through the code to find the area that does something close to the new feature, (2) trying to understand what is going on, (3) figuring out the style of it for conformity, and (4) slapping that bad boy in.

Of these, (4) is by far the easiest part and the only one Rust will help you in. The digging for understanding is far more time consuming. The other parts require art, discipline, and linters.

Re:Green vs. Brown Programming Languages by dnautics on Thursday April 22, 2021 @06:11PM (#26908795)
Yes, for example this week I had to uncover a bug why a backend was occasionally delivering duplicated database rows to a frontend, in code I hadn't written. I couldn't replicate the problem in test, or in dev, it was only in prod and stage (because the data in stage and prod was the right shape to trigger a UB wontfix in the postgres query optimizer).

Rust would not be friendly towards producing a RCA on this issue.

Re:Green vs. Brown Programming Languages by 13415 on Thursday April 22, 2021 @11:34AM (#26903926)
I'm going to be the heretic and predict the opposite about Go and Rust. The reason is that Rust is overengineered, allows for macros, and is getting more and more complicated all the time. It's going to be as complicated as C++ in 10 years from now. Go is kept simple, the team is reluctant to introduce large changes, and it was from the beginning planned as an "easier C" with automatic memory management.

I'd also like to challenge the idea that Rust is optimized for maintaining. It's optimized for backwards compatibility. IMHO Ada is way better for long-term maintainability and in that respect beats every other language I know.

Re:Green vs. Brown Programming Languages by brundolf on Thursday April 22, 2021 @12:03PM (#26904323)
That's actually a great point about macros. I have extremely mixed feelings about Rust's macros, but one of those feelings is that if anything is going to compromise its status as "the maintainable language" down the line, macros are the most likely.
Re:Green vs. Brown Programming Languages by 13415 on Thursday April 22, 2021 @12:20PM (#26904552)
That's also my impression about CommonLisp, which I otherwise like a lot. Macros are really handy but in the long run they force new programmers to learn DSLs forever. The same for templates, of course. They increase programmer comfort but decrease long-term maintainability. It's always a trade-off.
Re:Green vs. Brown Programming Languages by jcelerier on Thursday April 22, 2021 @05:22PM (#26908377)
> in the long run they force new programmers to learn DSLs forever.

but... that's a good thing. programs should be built as a collection of small DSLs tailored to the specific tasks of that program

Re:Green vs. Brown Programming Languages by zozbot234 on Thursday April 22, 2021 @12:36PM (#26904741)
You think macros are overly complicated? Have you looked at how people use C++ templates?
Re:Green vs. Brown Programming Languages by oblio on Thursday April 22, 2021 @01:09PM (#26905152)
He just presented C++ as being another over-complicated language :-)
Re:Green vs. Brown Programming Languages by bch on Thursday April 22, 2021 @09:45PM (#26910190)
> it's right there in the name: software should be allowed to become old and "collect rust"

Of course, names or intentions of things don’t really determine their quality, or we’d all be running our software on the alpha processor, namely the DEC Alpha. My pedantic comment is worth about as much, but might be interesting to some:

Rust isn’t named after iron oxide, it’s named after fungus[0][1][2].

[0] https://stackoverflow.com/questions/16494822/why-is-it-calle...

[1] https://en.wikipedia.org/wiki/Rust_(fungus)

[2] https://www.reddit.com/r/rust/comments/27jvdt/internet_archa...

Re:Green vs. Brown Programming Languages by kardianos on Thursday April 22, 2021 @12:03PM (#26904307)
Go is great for maintenance. It's actually annoying sometimes to build.
Re:Green vs. Brown Programming Languages by fonzi_3311 on Friday April 23, 2021 @09:57AM (#26914825)
>> I think Go is in a honeymoon phase and people will hate it in 10 years;

>> Rust on the other hand is optimized for maintaining

How come this post isn't flagged? Crazy ... How can someone more aggressively start a language flame war?

These kind of posts of an individual are the reason for the bad reputation of the Rust community.

Looking at the facts regarding the industrial usage and growth of Go and Rust in the real world one can only conclude that Go's honeymoon hasn't started yet.

There are so many reason why Go is much more likely to be maintainable 10 years from now:

- easier language

- massive standard lib

- professional maintainers at google

- garbage collector

- much, much more devs available

- very sensible maintainers to keep Go stable

- much more mature despite being not that much older

- ...

Re:Green vs. Brown Programming Languages by potta_coffee on Thursday April 22, 2021 @11:44AM (#26904051)
It doesn't seem to me that Rust and Go are really trying to solve the same problems and they don't appeal to the same demographic. The Rust vs Go conversation is tired and pretty much pointless, and I've avoided Rust simply because of the Rust community, which emanates a vibe that turns me off. I think the weight of software that is written in Go means it's going to be around a while (K8s / Docker / Terraform / etc) and I hope it stays because it feels like a breath of fresh air to me and I enjoy working with it.
Re:Green vs. Brown Programming Languages by mohanmcgeek on Saturday April 24, 2021 @01:45AM (#26922554)
Yes.

The Rust users seem to be spending all their time making Rust vs Go posts on the internet instead of making something killer enough to get people to use Rust.

Re:Green vs. Brown Programming Languages by xh-dude on Thursday April 22, 2021 @07:35PM (#26909415)
I don’t know, of course, but I have a different sense of where Go will be if it survives generics. The lack of change will mean it’s reliable, it was never as pretty as some other things, and it doesn’t go too far out of its niche. A lot of languages that suffer past the honeymoon, it isn’t survival of the fittest, it’s just evolving bloat or ending up with vestigial organs - this is hard to get on board with for new developers.
Re:Green vs. Brown Programming Languages by mohanmcgeek on Saturday April 24, 2021 @01:26AM (#26922488)
Go was in the honeymoon phase between 2013-2016. Considering how much unnecessary attention Rust gets in this forum despite being a terrible language to learn would suggest that Rust is the language currently in the honeymoon phase.

It's Rust that carries Ruby's and Scala's legacy of putting everything into the language. There's no forethought if it's a kitchen sink

Re:Green vs. Brown Programming Languages by pkolaczk on Saturday April 24, 2021 @03:39AM (#26923063)
I don't know about Ruby, but saying Scala and Rust put everything into the language is just totally incorrect. Both are designed with philosophy of building minimal set of features with very strong expressivity. For example Scala 3 removed a lot from the language and unified many features.

As for Rust. Is there inheritance in Rust? No. Overloading? No. Global or static (like Java static) variables? No. GC? No. Exceptions as the main error handling feature? No. N ways of casting to a different type? No. 5 or 6 ways of building dataclasses like in Python? No. 20 ways of packaging / building a project? Again - nope. I think this is already enough to say they didn't put everything into the language, and they are actually very careful not to introduce unnecessary features.

Actually I find Rust quite small, compared to e.g. Java or C++, but it has much better expressivity.

Re:Green vs. Brown Programming Languages by hnlmorg on Thursday April 22, 2021 @11:41AM (#26904020)
I've lost count of the number of times people have said that about a new language that has since fallen out of favour.
Re:Green vs. Brown Programming Languages by coldtea on Thursday April 22, 2021 @11:52AM (#26904174)
>Rust on the other hand is optimized for maintaining (it's right there in the name: software should be allowed to become old and "collect rust").

I think the name Rust is rather a pun because it was designed to be "close to the metal".

Re:Green vs. Brown Programming Languages by brundolf on Thursday April 22, 2021 @12:01PM (#26904278)
It's had various adjacent meanings over the years (and I may have embellished a little bit in my original interpretation), but here's one explanation which isn't far off: https://tim.dreamwidth.org/1784423.html

> Also, calling Rust a research language is funny to me because -- as its name reflects -- we've tried hard to avoid incorporating new technology into it. We haven't always succeeded at failing to be novel, but we have a rule of thumb of not including any ideas in the language that are new as of the past ten years of programming language research. The field of programming language is full of old technology that hasn't been put to use in solving problems that it's exactly suited for. The goals with Rust were to avoid reinventing wheels, and see what the past had to teach us.

Re:Green vs. Brown Programming Languages by zibzab on Friday April 23, 2021 @10:40AM (#26915206)
> Rust on the other hand is optimized for maintaining

I completely DISAGREE with this statement!

I have already seen many year-old Rust projects fail to build due to changes to language, compiler and core libraries.

Re:Green vs. Brown Programming Languages by aw1621107 on Friday April 23, 2021 @01:04PM (#26916780)
Out of curiosity, would you be able to provide concrete examples of those build failures?
Re:Green vs. Brown Programming Languages by zibzab on Friday April 23, 2021 @02:48PM (#26917831)
Just try random project from github without using nightly, alternatively try a project from 2018 with a current rustc.

Specially the debian/Ubuntu Rust packages have hard time compiling many recent projects.

Re:Green vs. Brown Programming Languages by steveklabnik on Friday April 23, 2021 @03:26PM (#26918244)
These two issues sound totally different, a 2018 project that doesn’t use nightly should absolutely compile today, unless there was a soundness issue. (And the vast majority of projects don’t use nightly features.)

The latter bit is the opposite, that is, old compilers can’t possibly know about new features, and that’s not a compatibility issue. That’s an older tool chain issue, or maybe a “community prefers newer tool chains than distros do” issue.

Re:Green vs. Brown Programming Languages by zibzab on Sunday April 25, 2021 @04:55AM (#26931324)
But how in gods name can you call a language "maintainable" if just compiling it after certain time requires some detective work to find the right rustc/cargo versions?

And that's only the first problem with maintaining old Rust projects. There are so many other issues, specially with projects created in very early Rust days.

Tell me, have you ever seen a go project failing due to similar issues? Python had this problem once (2 to 3) and they are still apologising for it.

(Not trying to start a language flame war. I like Rust and want it to succeed. But right now things are a bit chaotic)

Re:Green vs. Brown Programming Languages by steveklabnik on Sunday April 25, 2021 @10:19AM (#26932885)
I mean, it shouldn't! After some time, you'd be using a newer version. You want to be using an old rustc to compile a project created later in time. There are very very few languages that do not add new features over time. Even Go adds new standard library functionality or toolchain features in new releases.

The Python 2 to 3 situation is very different, that is about new versions not compiling old code. We go to great lengths to make sure that that works well in Rust.

Re:Green vs. Brown Programming Languages by eternalban on Thursday April 22, 2021 @09:16PM (#26910029)
That's some honeymoon! The wife is gonna be mad at me for taking the moon bit literally. It's been more than a decade now for Go. What honeymoon is this?

When I first saw Rust 1.0 spec, I made a mental note that "this will end in tears". (Do tears rust metal?) I made a similar prediction during Scala's honeymoon days: "This will be the JVM's C++".

Go will have a Java-lite career trajectory: it has a pretty wide sweet spot (in various dimensions) that more than compensate for its shortcomings.

The actual issue in this industry has been, and remains, the fact that it requires workers with above average intelligence that are tasked with building repetitive glorified book keeping applications. And in every programmer with a heart-beat's career, there comes a time when job boredom unconsciously lends a seductive glimmer to the shiny new thing. Java, Ruby, and Go all were in fact adopted because of the ambitious, smart, but bored, geeks decided they needed a brand new toy. (So taking your honeymoon metaphor, these trends are like mid-life crisis for programmers.)

And, compounding the issue is the fact that those minding the programmers were and remain (in the best cases) mostly behind the curve -- they're in meetings all day, after all -- and are simply not in a position to authoritatively smack down "let's use X!" enthusiasms. (In the general case, they are entirely clueless.)

Rust, like Scala, and Haskell, add an additional hook in that they offer the programming world's version of 'intellectual virtue signaling'. Case in point being your bon mot of "optimized for building".

Seriously, that's the actual job description for 99% of worker bees in this field: building things!

So, I'll make the prediction that Rust will go the way of Scala and Haskell, and there will come a brand new shiny and intellectually satisfying new thing and we'll have HN (in a typically forgetful fashion) dissing Rust and heaping praise on the new comer. This too shall pass.

[p.s. I have a self-contract to only post 1 message in a 24 hour period on the entire internet and this was it for tonight. /over & out]

Re:Green vs. Brown Programming Languages by mohanmcgeek on Saturday April 24, 2021 @01:42AM (#26922546)
> And, compounding the issue is the fact that those minding the programmers were and remain (in the best cases) mostly behind the curve -- they're in meetings all day, after all -- and are simply not in a position to authoritatively smack down "let's use X!" enthusiasms. (In the general case, they are entirely clueless.)

I don't think them smacking the "let's use x" is a good idea since it's the Devs who'll be writing the code.

The org needs a framework that answers: 1. How easy is it to train someone to use this stack? How long would it take for someone to start writing good code 2. How much time would it save us when building something new? 3. How easy is it for someone completely new to the codebase to start contributing?

1 and 2 can be easily measured within the org

You can use OSS as a proxy for 3