Hacker News new | ask | show | jobs
by eksemplar 2925 days ago
I think you misunderstood me. I don’t think it’s an improvement over c# (or Kotlin, but I have no experience with Kotlin so I wasn’t commenting on that).

I think it’s an improvement over JavaScript, Typescript and the Xamarin experience + tooling, with the added advantage of letting you share language in your clients.

I don’t think dart is great though, it’s just better than the terrible alternatives.

2 comments

TypeScript has ADTs, non-nullable types and the tooling is one of the best (great autocomplete, support for refactorings, incremental compilation, yarn is a great package manager, etc).

Its type system is also one of the most advanced in mainstream languages, being inferior only to Scala and Haskell.

In comparison, Dart doesn't have ADTs or non-nullable types. For a new language, I consider this very underwhelming.

I'm considering using Flutter for a new project because it seems to be a great platform, but having to use Dart instead of TypeScript is a step backwards.

>I think it’s an improvement over [...]Typescript

JS I understand, but what makes you prefer Dart over TypeScript in this case?

Here are my personal opinions as a long time Dart/JS/TS developer.

- Dart had a lot of features before either JS or TS. Important features like cancellable promises or optional chaining are still missing (I know they might be coming soon). Also some nice quality of life features like named constructors.

- As a superset of JS, Typescript has a lot of idiosyncrasies that might bother people. Personally I don't mind, but people new to web development often find Dart to be a friendlier experience, with fewer pitfalls.

- To me, and this is very subjective, the TS syntax is uglier than either JS or Dart. The types get in the way and add noise to the code. I find Dart's and pretty much any other language's type declarations much cleaner.

However, I have two very big problems with Dart that prevent me from using it as much as I'd like to.

- JS interop is much much cleaner in Typescript/Flow. Every compiled-to-JS language that isn't a superset suffers from this. It's what prevents me from using ReasonML seriously too.

- No support for JSX. I can't go back to writing nested createElement after using JSX

I thought reasonml's JavaScript interoperability was quite good, seems to compile faster and the type system cannot lie about it's inferences like it can in TS

But the main thing for me between TS and reason is exhaustive pattern matching is better in reason, it feels jacky in TS

could I use reasonml/js with flutter widgets and ignore dart?