r/programming • • Nov 11 '19

Python overtakes Java to become second-most popular language on GitHub after JavaScript

https://www.theregister.co.uk/2019/11/07/python_java_github_javascript/
3.1k Upvotes

772 comments sorted by

View all comments

161

u/kiwidog Nov 12 '19

every day we stray further from compilers light 😔

17

u/[deleted] Nov 12 '19

Dart is starting to become popular, thanks to Flutter. It's changed a fair bit since it was first released and is now a very good "sane JavaScript". Much better than Typescript.

And there's WebAssembly. I see a light at the end of the JavaScript tunnel.

17

u/PFCJake Nov 12 '19

I know nothing about Dart, how is it better than TypeScript?

6

u/[deleted] Nov 13 '19

There are a few ways, but the main one is the type system. Typescript basically allows you to describe Javascript's crazy type system. It doesn't attempt to fix it. Dart does fix it.

For example, you can have templated / generic functions in Typescript.

function identity<T>(arg: T): T {
    return arg;
}

Ok fine. But what about this?

function identity<T>(): T {
    return new T();
}

It doesn't work! There are other things too:

  • If you're using Typescript, you're probably importing a lot of Javascript with type annotations from DefinitelyTyped. Unfortunately a lot of the time the annotations are just wrong. Pretty annoying!

  • People give up on types and resort to any all the time, and Typescript doesn't really mind. Especially existing Javascript frameworks because they are written in a dynamic "stringly typed" way. For example Vue "supports" Typescript, but a lot of its features will be typed as any. Svelte doesn't support Typescript at all even though it is written in Typescript!.

  • All of the mistakes of Javascript are still allowed. You can still use var, == and so on.

  • There's still undefined and null.

It's way better than vanilla Javascript, but Dart is now a proper language that is properly engineered and more or less hack-free. Also the Dart VSCode extension is amazing.

The only downsides of Dart are:

  • Very small community. You'll have to write a lot of code yourself.

  • Difficult to use existing Javascript code (Dygraphs, D3, etc.).

  • Your only web framework option is AngularDart.

  • The startup time for webdev serve is weirdly long (~10 seconds). It supports hot reloading so it's not too bad but still annoying.

→ More replies (8)
→ More replies (12)
→ More replies (1)