News for hackers. Stuff that matters.
Re:Go 1/2 Proposal: Immutable Types by noncoml on Wednesday October 03, 2018 @01:28AM (#18127824)
I don’t know exactly why Go become successful but it is not because it’s a great language.
Re:Go 1/2 Proposal: Immutable Types by jazoom on Wednesday October 03, 2018 @06:36AM (#18129013)
I'm looking for a new language to write server code in. I have been using Node for years but I want something that compiles to machine code and is statically typed.

I've been looking at Go and I like that it is simple, has opinionated, official tooling, compiles very quickly for multiple platforms, is popular enough to have a decent library ecosystem, and I really like the idea of goroutines.

What language would you suggest would be better? Nim sounds cool but it's too new. It's not stable and has a small ecosystem.

Re:Go 1/2 Proposal: Immutable Types by mbo on Wednesday October 03, 2018 @04:57PM (#18134759)
> [Nim] is too new

It's actually a year older than Go (2008 rather than 2009).

If you don't want to use Nim because it's not stable enough or has too small an ecosystem (I disagree), you could try out Scala Native or Kotlin Native. A large portion of their ecosystem successfully compile to native code (although you may have issues with Scala Native compile times).

You can also check out OCaml.

Re:Go 1/2 Proposal: Immutable Types by jazoom on Wednesday October 03, 2018 @06:27PM (#18135344)
I guess I mean "new" as in still not stable (pre-1.0 and still sees breaking changes). The fact it's been around so long and still hasn't matured is not reassuring at all.

I have checked out OCaml but it's not mainstream enough to have libraries for... anything really. Here's the first thing I checked just now: https://www.elastic.co/guide/en/elasticsearch/client/communi...

The OCaml client was abandoned 5 years ago. Nim doesn't even appear on the page!

This page says Kotlin Native is still in preview: https://kotlinlang.org/docs/reference/native-overview.html

Also, I am not seeing a reason why Go is not a good choice.

Re:Go 1/2 Proposal: Immutable Types by mbo on Wednesday October 03, 2018 @11:46PM (#18137012)
> Also, I am not seeing a reason why Go is not a good choice.

I think you may have unnecessarily restricted yourself by wanting a language that produces native binaries and is GC'd. There simply _aren't_ that many mature and mainstream languages that compile to native binaries with a GC. I'd personally much prefer a more expressive language with a less robust ecosystem (and a virtual machine), but if an Elastic lib is a hard requirement for you, then I can't argue with your choice of Go.

Or use Haskell. Native binaries, opinionated, decent library ecosystem ;).

Re:Go 1/2 Proposal: Immutable Types by jazoom on Wednesday October 03, 2018 @11:52PM (#18137053)
I am already very familiar with 2 interpreted languages, but not very familiar with any compiled languages. I'm doing the exact opposite of restricting myself.

And it's not just Elasticsearch. That's just one example. I would come up against many other requirements. Here's just one more: https://nats.io/download

Edit: And you're right, Haskell is something I should probably look into more. I haven't thought about it too much since I already do a lot of functional programming in JavaScript and I don't hear too much about Haskell being great for creating API servers.

One of my other concerns is that the project I'm planning will be a long-haul, and will have several other developers join in future. I want to have a decent market to choose from. And, being in Australia, it's small enough as it is. I'll shy away from remote workers since it's relating to sensitive healthcare data.

Re:Go 1/2 Proposal: Immutable Types by mbo on Thursday October 04, 2018 @02:35AM (#18137674)
> I am already very familiar with 2 interpreted languages, but not very familiar with any compiled languages. I'm doing the exact opposite of restricting myself.

Like, no, compiling to machine code is only one class of compilation. All the VM-targetting languages have far more robust ecosystems than Go, with good abstractions, performance and tooling to boot. _Any_ language that targets the CLR or JVM should suffice.

Re:Go 1/2 Proposal: Immutable Types by jazoom on Thursday October 04, 2018 @02:47AM (#18137734)
>_Any_ language that targets the CLR or JVM should suffice.

That's a very bold thing to say when you don't even know what I'm planning to do with it. Like, NodeJS will "suffice". Why don't I just use that since I'm very experienced with it? Reasons. Why don't I use Java? Reasons.

I feel like this is going nowhere. I'll probably choose Go. Stranger on internet thinks I'm wrong. This is the story whenever the topic of programming languages comes up. Everyone thinks their preference is the one true preference.

Re:Go 1/2 Proposal: Immutable Types by mbo on Thursday October 04, 2018 @03:57AM (#18137981)
Yeah look, I do think you're wrong. You've given yourself a very tough set of constraints (has to compile to binaries, has to have a GC, can't be in preview, can't be under v1.0, can't have a slightly unstable API, has to have "good" libs for an arbitrary selection of tech, can't target a VM) that makes Go the only viable option - I'm questioning whether those are legitimate.

I'm not suggesting you use my personal favourite language, merely use anything but Go.

Re:Go 1/2 Proposal: Immutable Types by jazoom on Thursday October 04, 2018 @04:43AM (#18138157)
Yeah look, I do think you're wrong.

I respect your courage in just coming out and saying that.

You've given yourself a very tough set of constraints (has to compile to binaries, has to have a GC, can't be in preview, can't be under v1.0, can't have a slightly unstable API, has to have "good" libs for an arbitrary selection of tech, can't target a VM) that makes Go the only viable option

Half of that is "I want something stable", which is almost universally appreciated among programmers. The way you've said that makes it sound like I chose Go then decided "I want whatever he's having". No. I have a list of many "nice-to-haves" and Go satisfies more of them than any other language/ecosystem. It's as simple as that. If I was going to settle for 2nd place, I'd probably just use NodeJS. I am extremely productive in NodeJS, and I'm still not 100% sure I won't choose it for this next project.

I'm not suggesting you use my personal favourite language, merely use anything but Go.

Although I find that a strange position to take, I appreciate your honesty.

Re:Go 1/2 Proposal: Immutable Types by ernst_klim on Thursday October 04, 2018 @02:13AM (#18137576)
>to have libraries for... anything really

It has thousands of libraries, check opam out. If something is absent, why won't you write your own library anyway? Elasticsearch is really not that complex, here is the example:

https://github.com/cyborgize/es-cli

Re:Go 1/2 Proposal: Immutable Types by jazoom on Thursday October 04, 2018 @02:16AM (#18137596)
I addressed that in my other comment. It's not just Elasticsearch. That was one example out of at least 20 I could give you. The fact that there isn't even a client for the world's most popular search database is indicative of the ecosystem as a whole. It's fine if you use OCaml for whatever, but it's not what I'm looking for. Though, I am keeping my eye on this for personal interest: https://reasonml.github.io
Re:Go 1/2 Proposal: Immutable Types by ernst_klim on Thursday October 04, 2018 @03:12AM (#18137832)
>The fact that there isn't even a client for the world's most popular search database is indicative of the ecosystem as a whole.

It indicates that you haven't written one? That's a rather strange attitude, for sure it doesn't have a wrapper for any rest api, what it has is all needed tools for write it, that's what really matters. The tool in repo above does not even use a library, only generated bindings. It's much easier to write a client to a rest api in OCaml than in Go due to derivers [1], atdgen [2] and the power of the language. Take a look at graphql bindings as an example [3] [4].

[1] https://github.com/ocaml-ppx/ppx_deriving

[2] https://github.com/mjambon/atd

[3] https://github.com/andreas/ocaml-graphql-server

[4] https://www.youtube.com/watch?v=jaKcEGkItsY

Re:Go 1/2 Proposal: Immutable Types by dom96 on Wednesday October 03, 2018 @10:05AM (#18130284)
You should give Nim a go. The ecosystem is growing fast :)
Re:Go 1/2 Proposal: Immutable Types by jazoom on Wednesday October 03, 2018 @06:31PM (#18135367)
That's a good thing, but it means I might use Nim in 3-5 years, not right now. As a single dude without a team I need to spend time on getting things done, not building custom clients to databases etc.
Re:Go 1/2 Proposal: Immutable Types by hazz99 on Wednesday October 03, 2018 @02:18AM (#18128012)
Why do you think that?

I like it's stripped-down feature set, and opinionated concurrency (although it's occasionally clunky).

It's not perfect, and could have a lot more support for concurrency, but it's very workable and a joy to program in.

Re:Go 1/2 Proposal: Immutable Types by umanwizard on Wednesday October 03, 2018 @03:04PM (#18133670)
My personal problem with Go is that it doesn’t fit in any niche.

If you want language optimized for productivity with a lot of high-level features, use Python. If you want maximum performance and low-level control, use C++ (or C, or Rust). If you need relatively high performance but can tolerate it not being 100% in exchange for nice things like GC, use Java. Where does Go fit?

Re:Go 1/2 Proposal: Immutable Types by mbo on Wednesday October 03, 2018 @05:41PM (#18135079)
If we're being serious here, I'm pretty sure Go is specifically for very very large orgs and almost no-one else. Go optimises for low GC pause time, fast compile times and in-your-face concurrency at the expense of almost everything else. The fact that CSP is formalised and well studied, and the lang itself is sufficiently C-like and stripped down makes it amenable to large scale static analysis as well.
Re:Go 1/2 Proposal: Immutable Types by jazoom on Wednesday October 03, 2018 @06:34PM (#18135384)
If you need relatively high performance but can tolerate it not being 100% in exchange for nice things like GC, use Go. Where does Java fit in?
Re:Go 1/2 Proposal: Immutable Types by umanwizard on Wednesday October 03, 2018 @07:28PM (#18135671)
Java has existed for dramatically longer than Go and is extremely well-supported, both in terms of the core language and the tooling ecosystem.

You need a good reason to get rid of the incumbent, it's not just arbitrary.

Re:Go 1/2 Proposal: Immutable Types by jazoom on Wednesday October 03, 2018 @07:41PM (#18135748)
IMO there are plenty of reasons for me not to use Java. I could write an essay on it, but the only one that really matters is that for the 4 years that I coded in Java, I didn't enjoy it.

And to suggest Go doesn't offer anything different to Java is just silly.

Re:Go 1/2 Proposal: Immutable Types by noncoml on Wednesday October 03, 2018 @09:16PM (#18136291)
Curious, what does it offer other than the goroutines and the native compilation?
Re:Go 1/2 Proposal: Immutable Types by vmchale on Wednesday October 03, 2018 @04:21PM (#18134473)
> I like it's stripped-down feature set

How could the absence of sum types possibly be a good thing?