News for hackers. Stuff that matters.
Re:Learning Go by porting a medium-sized web back end from P... by oblio on Thursday November 09, 2017 @04:23AM (#15661003)
I really wish that there was a language which had these features:

- simple (so not Scala, Haskell, Perl 6, etc.; no Rust either, unfortunately)

- clean (nice syntax, preferably Python inspired, but consistent)

- modern (generics, some functional features, string interpolation, etc.)

- decent concurrency/parallelism story

- good IDE, preferably supported by the core dev team

- compilation to a (possibly static) native binary

- decently big ecosystem

- and a big enough community of contributors or commercial backing from at least 1 stable entity

- also preferably didn't have a lot of historical baggage

From what I gather C# might actually be close to this, 2-3 years from now, if the .Net Core transition happens smoothly and the OSS community adopts it... Who knows, maybe even Kotlin 2019 or so?

Re:Learning Go by porting a medium-sized web back end from P... by oweiler on Thursday November 09, 2017 @05:14AM (#15661240)
Kotlin covers all those features

- much simpler than Scala while still being much more expressive than Java

- clean syntax, with a higher consistency than e.g. Java

- Generics, Higher Order Functions, Multiline-Strings, Destructuring, ADTs, Pattern Matching

- Coroutines (experimental but production-ready)

- IntelliJ Community Edition (or Ultimate)

- not yet but will be possible with Kotlin Native

- has its own ecosystem but also has great interoperability with Java

- stable for quite some time, big community

- well, a little bit for reasons of Java-interoperability; on the other hand

Re:Learning Go by porting a medium-sized web back end from P... by _Codemonkeyism on Thursday November 09, 2017 @06:45AM (#15661607)
I like Kotlin too, but in which way is it "much more expressive" in your opinion? What can you express in Kotlin that you can't express in Java? Scalas type system is much more expressive than the one in Java as an example. Only thing that comes to mind in Kotlin is non-nullable references.

Most of the stuff in Kotlin looks more like less boiler plate (data classes) than "more expressive".

Re:Learning Go by porting a medium-sized web back end from P... by oweiler on Thursday November 09, 2017 @09:11AM (#15662480)
There are quite a few things in Kotlin which are not possible in Java

* Top level declarations

* Sealed classes

* Coroutines (in Java this is currenty only possible with Bytecode manipulation)

* Inlined Functions and Reified Generics

* Covariant Collections

* Tail Recursion

Re:Learning Go by porting a medium-sized web back end from P... by calcifer on Thursday November 09, 2017 @05:35PM (#15666358)
> Reified Generics

It's implemented with some bytecode hackery and hence limited to inlined functions [0], which makes it significantly less useful.

Funny how a misguided design decision from the Java 1.5 days (running generic 1.6 code with a 1.5 jre) still haunts us today...

[0] https://kotlinlang.org/docs/reference/inline-functions.html#...

Re:Learning Go by porting a medium-sized web back end from P... by _Codemonkeyism on Friday November 10, 2017 @03:05AM (#15668617)
See "Brian Goetz - Stewardship: the Sobering Parts" https://www.youtube.com/watch?v=2y5Pv4yN0b0&t=3399s
Re:Learning Go by porting a medium-sized web back end from P... by _Codemonkeyism on Thursday November 09, 2017 @10:19AM (#15663083)
I do not argue that Kotlin is a nicer and a language with more features that are useful.

What of these would you call "more expressive"? I'd agree with sealed classes, they express a limited set of possible classes. Perhaps tail recursion as I can express problems in way of recursion without stack overflows. I don't think coroutines are more expressive than Futures/get, only a runtime optimization for many concurrent executions.

Re:Learning Go by porting a medium-sized web back end from P... by joshuamorton on Thursday November 09, 2017 @12:37PM (#15664233)
Async/await coroutines (C#, python, ECMAscript 7) are much nicer than futures, at least ime. I think that in terms of expressiveness of async code it goes

callbacks -> futures/promises -> coroutines

Because callbacks are a completely different style of code, your async looks totally different. Futures and promises are better, but still make it difficult to ever break out of the async context, coroutines make the difference between async and normal code nonexistant, and allow clean escape from an async context.

Re:Learning Go by porting a medium-sized web back end from P... by rbobrowicz on Thursday November 09, 2017 @11:26AM (#15663675)
>Tail Recursion

Interesting. I thought the lack of proper tail recursion is a JVM limitation. Hence why Clojure uses loop/recur to handle it by translating it to a loop rather then as an actual tail call. Which means things like mutually recursive functions are not possible in Clojure without blowing the stack.

How does Kotlin handle that? Is it internally rewriting to a loop or trampoline, or did they find some way to actually make proper tail calls?

Re:Learning Go by porting a medium-sized web back end from P... by calcifer on Thursday November 09, 2017 @05:40PM (#15666385)
> Is it internally rewriting to a loop

Yes. You add a `tailrec` modifier to your function. The compiler then checks if the last op in the function is a call to itself. If it is, it gets replaced with a loop. If not, you get a warning that `tailrec` is ignored.

Re:Learning Go by porting a medium-sized web back end from P... by pabl0rg on Thursday November 09, 2017 @08:42AM (#15662236)
It's not immediately obvious, but when you write some Kotlin you'll see.

Little things that are a apin in Java and elsewhere are quick and natural in Kotlin:

- nullable types are smoother than Options - null checks are relatively painless - the stdlib works with you, not against - named parameters and optional parameters means no need for builders - etc. Etc.

Re:Learning Go by porting a medium-sized web back end from P... by _Codemonkeyism on Thursday November 09, 2017 @10:16AM (#15663056)
I have written some Kotlin, and perhaps it's me, but I don't see.

"nullable types are smoother than Options - null checks are relatively painless"

Might be the case, but Options are more expressive in that I can combine them and restrict them with other type classes to express larger constraints. Reusabilty is higher e.g. with Monad transformers like OptionT.

So nullable types are less code, but also less expressive as building blocks of larger constructs.

They might be also less expressive because they conflate two concepts: Not initialized and not-there, whereas Option expresses not-there and _ (in Scala) expresses not-initialized.

"named parameters and optional parameters"

Not sure how this more expressive?

Re:Learning Go by porting a medium-sized web back end from P... by beagle3 on Thursday November 09, 2017 @05:28AM (#15661308)
Nim has everything nailed down except the ecosystem/commercial backing; It does have some of those, but not to the extent that I would blindly tell you they are there.

It's as fun as writing Python (with a similar syntax), but it has essentially all the goodies you want from Lisp when you need them, runs as fast as equally optimized C, produces standalone native binaries, _or_ standalone JavaScript if that's your thing.

Re:Learning Go by porting a medium-sized web back end from P... by narimiran on Thursday November 09, 2017 @09:51AM (#15662830)
When I started reading the feature list above, Nim was the first thing that came to my mind, until I saw the thing you mention:

> except the ecosystem/commercial backing

If this is not the most important feature on that list, here is one more vote for Nim. Give it a try, it might (pleasantly) surprise you!

Re:Learning Go by porting a medium-sized web back end from P... by reacharavindh on Thursday November 09, 2017 @08:48AM (#15662284)
Cheers to Nim. I'm learning it in my spare time for fun. However, I will not consider using it for anything more than toy projects until it hits 1.0. Hopefully soon.
Re:Learning Go by porting a medium-sized web back end from P... by narimiran on Thursday November 09, 2017 @09:47AM (#15662783)
> I will not consider using it for anything more than toy projects until it hits 1.0. Hopefully soon.

It should happen soon (TM), but from what I understand it will be just another version, just this time renamed to 1.0 - this basically means you could start using it more seriously even now.

Re:Learning Go by porting a medium-sized web back end from P... by reacharavindh on Thursday November 09, 2017 @11:55AM (#15663911)
Yeah. I understand that it will be just another version with not that many changes. Nim as it currently already feels stable and solid. But, I believe v1.0 release will carry a commitment to not introduce breaking changes at least for reasonable period of time after.
Re:Learning Go by porting a medium-sized web back end from P... by egeozcan on Thursday November 09, 2017 @05:31AM (#15661317)
I wish there was a Go->Nim compiler or a way to simply import stuff from Go :) I'm just half-joking to be honest.
Re:Learning Go by porting a medium-sized web back end from P... by beagle3 on Thursday November 09, 2017 @06:03AM (#15661438)
Go can generate .so/.dll usable from C; Nim can use them.
Re:Learning Go by porting a medium-sized web back end from P... by Santosh83 on Thursday November 09, 2017 @11:37AM (#15663782)
What's the IDE support like for Nim?
Re:Learning Go by porting a medium-sized web back end from P... by beagle3 on Thursday November 09, 2017 @01:41PM (#15664726)
va code extension, vin plugin, enacts mode all very functional. There’s aporia, written in Nim, but it is not as advanced.

Nim itself does not come with an IDE, but does include nimgrep and nimsuggest which underlie intelligence and other features in every IDE setup.

Re:Learning Go by porting a medium-sized web back end from P... by Can_Not on Friday November 10, 2017 @12:23PM (#15671368)
Does Nim have a good story for borrowing c/c++ ecosystems?
Re:Learning Go by porting a medium-sized web back end from P... by beagle3 on Friday November 10, 2017 @12:54PM (#15671609)
Yes. The most common compilation path is through C or C++, which together with the source-based FFI makes the integration mostly seamless.

There’s also c2nim which will generate the bindings for you (though it might need some hand holding if the header files make extreme use of macros)

Re:Learning Go by porting a medium-sized web back end from P... by cjsuk on Thursday November 09, 2017 @04:34AM (#15661057)
A lot of people I know are bailing on .net because it doesn’t live up to the promises. Everyone else gets the cool stuff first, the vendor that owns it is a dick and there has been so much schizophrenia over the last few years that it’s a business risk adopting it in case you have to throw your product under a bus again.

Go is showing itself to be a good compromise especially with the simplified nature of deployment and runtime stuff. It’s like a safer, higher level C, with a decent runtime library. That has so much mileage.

I’ve learned one thing as well over the last 15 years of using .net as well. An IDE is a monolithic brain damager. If you have to do something outside the scope of it, you’re shot. Give me an extensible text editor and shell.

Re:Learning Go by porting a medium-sized web back end from P... by pjmlp on Thursday November 09, 2017 @04:40AM (#15661089)
I wonder where, in this little corner of the Earth, it keeps being Java and .NET as it has always been the last 20 years.
Re:Learning Go by porting a medium-sized web back end from P... by cjsuk on Thursday November 09, 2017 @04:42AM (#15661103)
Java is fine to be honest. It’s a good solution.

Now I’m going to duck for cover!

Re:Learning Go by porting a medium-sized web back end from P... by maxxxxx on Friday November 10, 2017 @01:55PM (#15672031)
You are pretty much describing my thought process. .NET is comfortable but the cool stuff is happening on other platforms.
Re:Learning Go by porting a medium-sized web back end from P... by pwdisswordfish on Thursday November 09, 2017 @06:46AM (#15661610)
> A lot of people I know are bailing on .net

Crazy attracts crazy, now you know.

Re:Learning Go by porting a medium-sized web back end from P... by didibus on Thursday November 09, 2017 @01:24PM (#15664593)
By simple, you mean easy?

What about Java? Its easy, modern in the way you describe, has a good concurrency story, multiple great IDEs, can compile to a static binary with commercial JVMs, or experimentally in OpenJDK9. Really big ecosystem. Huge commercial backing. It just maybe fails at historical baggage and syntax.

Kotlin fixes those last two. And Java 10 will also fix a good chunk of the syntax complaints.

In all fairness though, I think you're focused on nitpicks that have no practical benefits. You're asking for a language with a better user experience. Which is great, as it can make programming more pleasant, and I'm all for it.

That said, I'd focus on language changes that provide functional value. Haskell adds a powerful correctness layer at a low expressiveness cost. Go adds a useful CSP concurrency mechanism with green threads, as well as being friendly to containerisation. Erlang and co add a great deal of reliability features and massive parallelism with first class actors. Clojure gives you powerful metaprogramming, state of the art immutability and a similar CSP layer as Go, while maintaining the access to Java's large ecosystem. Kotlin adds null type checking, and better functional primitives. Rust gives you safe memory access without the performance overhead of a GC. Chapel allows for super parallel computing. Scala gives you OOP with the safety layer of Haskell on it. Nim gives you faster python, with type safety. Crystal gives you faster Ruby with type safety. Etc.

Those are the languages that challenge the status quo, and have a chance at bringing real value in terms of the average output they result in when used to program with.

A slightly better UX for Java or Python is a hard sell. Its like the famous Unix quote: "the most dangerous enemy of a better solution is an existing codebase that is just good enough." - Eric S. Raymond

Java, C#, Python, Ruby, C++ are all good enough, even UX wise, to be displaced by something that doesn't offer compeling functional value. At least, in my opinion.

Re:Learning Go by porting a medium-sized web back end from P... by pjc50 on Thursday November 09, 2017 @04:35AM (#15661063)
C# actually already has most of that except for "compilation to a (possibly static) native binary", which is really just a convenience for shipping. It's also not really very cross-platform, it's definitely a "Windows First" language.
Re:Learning Go by porting a medium-sized web back end from P... by lwansbrough on Thursday November 09, 2017 @05:34AM (#15661331)
I'd recommend continuing to look into .NET Core. It's really quite stable these days and has all of the features you've mentioned, as well as C# having a lengthy history as a language. Knowledge is relatively transferrable amongst JS (especially TypeScript) developers, as well as Java developers. This puts you into an area where finding capable people is easy and cost-conscious (vs. niche languages.) Historical baggage has also been trimmed with .NET Core, and Microsoft has done well maintaining the language over time (adding new concepts and removing old ones.)

In a couple years, .NET Core will be even more stable and will surely have convinced the stragglers in the community to adopt it. (I'm seeing this is already mostly the case, because everyone likes not being locked into Windows.)

I'm a pretty big fan of .NET Core (coming from Node.JS) and I really do expect it to grow a lot in the next few years as people discover how easy and sane it is.

Re:Learning Go by porting a medium-sized web back end from P... by pjmlp on Thursday November 09, 2017 @04:44AM (#15661113)
C# has always had "compilation to a dynamic native binary" since version 1.0 via NGEN.

Mono has always supported "compilation to a (possibly static) native binary".

Windows 8 introduced "compilation to a dynamic native binary" on the Windows Store via the Bartok compiler used in Singularity.

Windows 10 adopted "compilation to a static native binary" with .NET Native, based on Midori compiler toolchain.

The .NET Core team has CoreRT for the same purpose.

Re:Learning Go by porting a medium-sized web back end from P... by egeozcan on Thursday November 09, 2017 @05:08AM (#15661213)
> it's definitely a "Windows First" language

C# used to be that but I don't think that's the direction anymore.

Re:Learning Go by porting a medium-sized web back end from P... by mkesper on Thursday November 09, 2017 @07:07AM (#15661715)
Which platform-agnostic GUI toolkit do you use?
Re:Learning Go by porting a medium-sized web back end from P... by egeozcan on Thursday November 09, 2017 @07:33AM (#15661840)
HTML but there's always GTKSharp: http://www.mono-project.com/docs/gui/gtksharp/
Re:Learning Go by porting a medium-sized web back end from P... by symlinkk on Thursday November 09, 2017 @10:24AM (#15663124)
Which platform-agnostic GUI toolkit do you use for Go? What about Python?

No language ships a cross-platform GUI toolkit in its standard library.

Re:Learning Go by porting a medium-sized web back end from P... by lmm on Thursday November 09, 2017 @11:25AM (#15663668)
TCL comes with TK, Python comes with PyTk, Java comes with JavaFX...
Re:Learning Go by porting a medium-sized web back end from P... by masklinn on Thursday November 09, 2017 @04:39AM (#15661083)
OCaml seems to match a majority of the criteria, though AFAIK no "good IDE" (tooling like merlin is available, but if you're looking for e.g. a refactoring IDE you're probably SOL), the ecosystem is small, and it does have some historical baggage.
Re:Learning Go by porting a medium-sized web back end from P... by Double_a_92 on Thursday November 09, 2017 @07:21AM (#15661792)
> - clean (nice syntax ...)

Just looked at wikipedia examples and the code is full of special chars and shortened keywords. Doesn't look nice or simple to me, tbh.

Re:Learning Go by porting a medium-sized web back end from P... by masklinn on Thursday November 09, 2017 @11:42AM (#15663815)
I guess beauty is in the eye of the beholder, though your eye seems questionable, the only "shortened keywords" I can find in the wikipedia page are "rec" (which is a long-standing shortening of "recursive" in recursive lets) and "fun" (for functions).
Re:Learning Go by porting a medium-sized web back end from P... by TheAceOfHearts on Thursday November 09, 2017 @12:58PM (#15664376)
As another commenter mentioned, you might want to try out Reason [0]. It's a new-ish programming language from Facebook that uses OCaml as its backend.

[0] https://reasonml.github.io

Re:Learning Go by porting a medium-sized web back end from P... by hajile on Thursday November 09, 2017 @12:48PM (#15664310)
SML is what Ocaml should have been. With a few small syntactic changes (mostly to add some nice-to-have features), SML syntax would be better in every way instead of almost every way.
Re:Learning Go by porting a medium-sized web back end from P... by cies on Thursday November 09, 2017 @04:44AM (#15661112)
And with the ReasonML frontend there is a much more approachable-for-other-language-refugees syntax to it.
Re:Learning Go by porting a medium-sized web back end from P... by mbenoni7 on Thursday November 09, 2017 @01:18PM (#15664525)
OCaml is great, but F# is better for almost every one of his bullet points.
Re:Learning Go by porting a medium-sized web back end from P... by pjmlp on Thursday November 09, 2017 @04:42PM (#15666081)
Only if it gets again more love from .NET team.

As it stands, I would rather bet on OCaml.

Re:Learning Go by porting a medium-sized web back end from P... by mfontani on Thursday November 09, 2017 @04:36AM (#15661071)
Other than the compilation to binary, Elixir seems a good fit for what you're looking for
Re:Learning Go by porting a medium-sized web back end from P... by dnautics on Thursday November 09, 2017 @05:02AM (#15661179)
Elixir compiles to bytecode which is not half bad
Re:Learning Go by porting a medium-sized web back end from P... by masklinn on Thursday November 09, 2017 @05:59AM (#15661431)
Pretty much everything compiles to bytecode (e.g. Java does, Python does, C# does, …)

I expect they want a native binary (possibly even statically linked) so they can trivially distribute the artefact without requiring that the VM be installed or bundled which is a PITA, in which case "compiles to bytecode" is useless.

Re:Learning Go by porting a medium-sized web back end from P... by dnautics on Friday November 10, 2017 @02:52PM (#15672412)
sorry, i should have said compiles to a bytecode that's not half bad
Re:Learning Go by porting a medium-sized web back end from P... by hawski on Thursday November 09, 2017 @11:53AM (#15663898)
C38 (so when the world ends):

- arrays with slices (that could also be used for strings) and Cilk Plus array notation [1]

- maybe actual string type with separate concatenation operator (possibly space as awk uses and C for literal strings) it could probably be folded to improved arrays

- standard SIMD vector types so that most use for operator overload disappears

- cleaned up standard library

- actual macros so the remaining use for operator overload disappears

- module system (so you would generally not need make and could easily compile to static binary)

- already you can build with static musl libc [2]

- something like libdill [3] or libmill [4] in stdlib

- there are multiple good IDEs, debuggers, analyzers

- one of biggest ecosystems and communities

- historical baggage mostly cleaned up

[1] https://en.wikipedia.org/wiki/Cilk#Array_notation

[2] https://www.musl-libc.org

[3] http://libdill.org/

[4] http://libmill.org/

Re:Learning Go by porting a medium-sized web back end from P... by nicoburns on Thursday November 09, 2017 @05:36AM (#15661341)
Swift is a potential competitor in this space too.
Re:Learning Go by porting a medium-sized web back end from P... by s_kilk on Thursday November 09, 2017 @08:04AM (#15662011)
Take a look at Elixir, it covers most of what you want.
Re:Learning Go by porting a medium-sized web back end from P... by lenkite on Thursday November 09, 2017 @04:42AM (#15661105)
Believe kotlin (especially kotlin-native) should soon relieve all those itches.
Re:Learning Go by porting a medium-sized web back end from P... by oblio on Thursday November 09, 2017 @05:15AM (#15661248)
Yeah, but Kotlin Native loses all the Java libraries. The more interesting thing would be Java native compilation coupled with Kotlin. So you'd write a Kotlin Java app and pass that through the Java native compiler introduced in Java 9. Unfortunately that's a beta feature right now, I think it only supports Linux x64, that's why I said Kotlin 2019, I assume that by then the Java native compiler will support all Java platforms.
Re:Learning Go by porting a medium-sized web back end from P... by pjmlp on Thursday November 09, 2017 @05:33AM (#15661326)
Java compiles to native code since version 1.0, only not for free.

All commercial JDKs had this option in one form or the other, and many of them are still around.

If you want to try this for free on open source projects, Excelsior JET is one option.

Re:Learning Go by porting a medium-sized web back end from P... by oblio on Thursday November 09, 2017 @05:41AM (#15661352)
I'm probably too conservative, but I'd rather use these kinds of things from the actual platform developers. I'm a bit more liberal with libraries, but in general I want the compilers/interpreters from the upstream source. Software has enough bugs as is :)
Re:Learning Go by porting a medium-sized web back end from P... by pjmlp on Thursday November 09, 2017 @06:33AM (#15661559)
Commercial JDKs, like from IBM or OEMs for embedded platforms, are the actual platform developers.
Re:Learning Go by porting a medium-sized web back end from P... by mhd on Thursday November 09, 2017 @10:31AM (#15663197)
> Java compiles to native code since version 1.0, only not for free.

Well, there was GCJ, but I think that hurt more than it helped.

Re:Learning Go by porting a medium-sized web back end from P... by squeaky-clean on Thursday November 09, 2017 @11:52AM (#15663891)
I think my dream language would be C# but with a slightly more Pythonesque syntax (significant indentation, no semicolons or braces...). I wonder if a transpiler like that exists.
Re:Learning Go by porting a medium-sized web back end from P... by mbenoni7 on Thursday November 09, 2017 @01:12PM (#15664495)
You can write "Pythonesque C#" today using F#.

Once you get used to it, though, you'll probably want to write idiomatic F#.

Re:Learning Go by porting a medium-sized web back end from P... by dilap on Thursday November 09, 2017 @12:08PM (#15664023)
seems like Go 2 has a good chance of being this (at least if you consider its syntax clean, which I do).

basically go is missing from your list is generics and string interpolation.

Re:Learning Go by porting a medium-sized web back end from P... by hajile on Thursday November 09, 2017 @12:49PM (#15664321)
I think F# has the things you're looking for.
Re:Learning Go by porting a medium-sized web back end from P... by jhh on Thursday November 09, 2017 @04:32AM (#15661051)
Kotlin comes to mind.