Remix.run Logo
vips7L 4 days ago

Darts pretty good. It has a lot of modern features, nullable types, pattern matching, sum types, and factory constructors; some really good build tooling. It can compile fully AoT.

saagarjha 4 days ago | parent [-]

It’s not very good if you’re comparing it against Kotlin or Swift though.

realusername 4 days ago | parent | next [-]

It's a matter of taste, even just the swift example on this website makes me raise eyebrows.

saagarjha 3 days ago | parent [-]

I think that is valid because the syntax shown off here is controversial. However, I think Dart is just generally worse in almost all of its features.

wiseowise 4 days ago | parent | prev | next [-]

It is great if you’re comparing it against Kotlin or Swift, unless you’re stuck in an era of 1.x Dart.

saagarjha 3 days ago | parent [-]

I would consider it to be weaker in power to both

wiseowise 3 days ago | parent [-]

Programming languages aren’t anime.

satvikpendem 4 days ago | parent | prev | next [-]

Eh, it's getting there, slowly at first but more rapidly now. It now got tearoffs, I explained in another comment but

> if you have an `enum Color { red, blue }` and a function takes `Color`, you can just do `f(.red)` not `f(Color.red)`

Dart is getting new features pretty fast, they really started focusing on the DX more after Dart 2 and now especially after Dart 3. Macros were supposed to ship but it was incompatible with the goals of fast compilation, so other sorts of smaller features will ship instead.

virtualwhys 4 days ago | parent [-]

Big turnoff with Dart is the lack of json (de) serialization -- kind of shocking to have to resort to source code generation libraries in a modern language.

Also, statement based instead of expression based, and not immutable by default are kind of a drag; not the end of the world but a bit unpleasant, IMO.

satvikpendem 4 days ago | parent | next [-]

Serialization support is coming, probably this year. As for statements vs expressions, it does have some expressions such as if and for inside lists but changing it wholesale to an expression based language would be too much of a breaking change.

virtualwhys 3 days ago | parent [-]

Serialization support has been coming for years, I lost patience.

Otherwise, yes, some support for expressions, some support for immutability, no support for optional semi-colons, no privacy modifiers so "_" littered everywhere.

I just found it to be an exceedingly ugly language when I used it a couple of years ago. Yes, some more pleasant modern functionality has been bolted on since then, but it's unfortunate that Dart was chosen as the backing language for Flutter, which is an awesome mobile framework.

satvikpendem 3 days ago | parent [-]

Serialization has always been possible via libraries, so most people were doing fine with that, what is coming is native serialization support, but in practice it will be functionally the same, ie rather than you running build_runner, the compiler will do it for you. I'm not sure what you used but that's what you were hung up on, there were always ways to solve it.

Dart is a pragmatic language, it has everything you need and has a lot of benefits too, such as sound null checking (very few languages have this, Rust comes to mind), JIT and AOT support (Javascript / TypeScript such as for React Native doesn't, and Kotlin is just getting there with Kotlin Native but it still has a lot of issues), and now more functional programming concepts with algebraic data types via sealed classes and pattern matching.

What language would you have chosen when Flutter came out circa a decade ago, or, we can be even more charitable and ask what language would you use today if you were to implement Flutter? I'm curious because everyone has their own ideas but they all don't work for one reason or another.

dtmorgan 2 days ago | parent [-]

[dead]

vips7L 3 days ago | parent | prev [-]

I thought dart could natively deserialize via dart:convert? It just only decodes to lists and maps, you have to manually map into classes.

4 days ago | parent | prev [-]
[deleted]