News for hackers. Stuff that matters.
Re:Write in JavaScript, Render in Flutter by mhoad on Saturday September 18, 2021 @07:07PM (#28580167)
I feel like maybe it has been a long time since people took a real serious look at Dart but you couldn’t possibly convince me to switch it out with JavaScript in most contexts let alone when trying to build a UI.

I spent a year looking for a new language in the pandemic and went from Ruby to Typescript, JavaScript, Java, and even a little C# but by such a long margin Dart was my favourite.

Re:Write in JavaScript, Render in Flutter by rickspencer3 on Saturday September 18, 2021 @10:22PM (#28581171)
I have to agree with you. For the domain of writing mobile applications with async communication with various services, Dart (in combination with Flutter) seems to allow my to crank more production quality code faster.

More specifically: 1. The Flutter library as a widget toolkit is very intuitive for me. 2. The idiomatic way of extended UI classes through encapsulation is very productive and readable for me. 3. The declarative way in which you configure classes makes other people's code easy to understand. 4. The various methods of doing async lead to many fewer bugs (for me, an average at best coder) than other libraries. 5. It's pretty easy to build an apk and get it on your phone.

All that said, I have never succeeded in getting an iOS build into the store. The build system seems like a house of cards built on top of a house of cards. I know it's possible, but I have never had the patience to power through.

Re:Write in JavaScript, Render in Flutter by rlp on Saturday September 18, 2021 @07:34PM (#28580319)
Any particular reason you like Dart so much? I tried it briefly, and it felt like a watered-down mashup of Java and C# with somewhat worse performance.
Re:Write in JavaScript, Render in Flutter by mhoad on Saturday September 18, 2021 @07:58PM (#28580466)
A few things stood out to me and I think it really came out of the fact that Dart was as I originally understood it designed to be a replacement for both Java and JavaScript which probably feels instantly obvious to anyone who has spent much time with it in terms of style and patterns. To me it’s like all the good parts of each and none or few of the bad.

Basically Google hired a bunch of PhD types to design something from the ground up that would run anywhere, compile to native, compile to JavaScript and soon to WASM. It’s fully object oriented but also has first class support for functions and everything that enables.

It has fully sound null safety, the tooling they have around it is also amazing for example code can rewrite itself to update to latest APIs and patterns just by running ‘dart fix’. But it’s a very boring and predictable language that’s easy to use and never really surprises me with quirks.

Re:Write in JavaScript, Render in Flutter by refulgentis on Saturday September 18, 2021 @07:52PM (#28580425)
Exactly. I can't tell you how refreshing that is after 5 years on of Kotlin and Swift. One way to do everything, terse syntax that assumes memory managements, and functional. Amazing stuff.
Re:Write in JavaScript, Render in Flutter by cutler on Saturday September 18, 2021 @09:21PM (#28580875)
In practice how is Dart functional? All I see in Flutter is classes all over the place. It's like no-one learned anything from the evolution of React and the decline of Angular.
Re:Write in JavaScript, Render in Flutter by Zababa on Saturday September 18, 2021 @11:19PM (#28581400)
Mostly because it has first-class functions and that's about it. Future might be used as a monad, but I'm not sure. Currently it has no ADTs, no pattern matching, Java-like immutability, null safety seems to be a special compiler feature rather than an option type or monad.

Right now it's less functional than Java, about as much as JavaScript (though in JS classes are less idiomatic so maybe it's a bit more functional in practice).

Considering what people are asking to add to the language (https://github.com/dart-lang/language/blob/master/working/05...), I wish people would start with a minimal functional language (Caml/SML without the modules, so functions, pattern matching and ADTs mostly) and then add things from there. It's a strong basis for a language, and people are going to ask for that stuff later anyways.

Re:Write in JavaScript, Render in Flutter by satvikpendem on Saturday September 18, 2021 @09:19PM (#28580863)
Sound null safety is one that most languages don't have.

Also looks like they're going to include static meta-programming, so you can metaprogram at compile time rather than runtime like many languages [0]. With this, many language features can be implemented yourself rather than needing the language maintainers to do so, such as adding dataclasses or (React-like) hooks. And if the state of the art changes, the language won't need to be redesigned or more stuff bolted on, you can just swap out the old language feature (as a package) and swap in the new one.

[0] https://github.com/dart-lang/language/issues/1482

Re:Write in JavaScript, Render in Flutter by rlp on Sunday September 19, 2021 @07:44AM (#28583564)
Very cool! I'd love to see proper macros in a major language like Dart. And the proposal looks good, like a mix of Scala and Nemerle.
Re:Write in JavaScript, Render in Flutter by mst on Sunday September 19, 2021 @10:18AM (#28584508)
I'm rather impressed by nim's macro system - basically the build system contains a nim interpreter that handles the macros while still giving you compiled output.

(I wouldn't stretch to calling nim 'major' but I will say I've found it fascinating so far)

Re:Write in JavaScript, Render in Flutter by alexandr1us on Sunday September 19, 2021 @04:38PM (#28587713)
Call me crazy but I am pretty sure this comment is written by paid lobbyists
Re:Write in JavaScript, Render in Flutter by flutterwascrap on Sunday September 19, 2021 @02:20AM (#28582108)
> ...but by such a long margin Dart was my favourite.

Are you joking? I don't have any biases for or against dart and understand why they created a new language instead of picking an existing one. But honestly, dart is not a very good language to program in.

Why do you think dart is better than these other languages "by a long margin"?

Re:Write in JavaScript, Render in Flutter by CrimsonRain on Sunday September 19, 2021 @03:17AM (#28582353)
May be you should write why dart is bad instead
Re:Write in JavaScript, Render in Flutter by flutterwascrap on Sunday September 19, 2021 @03:35AM (#28582438)
I didn't say dart is bad, it's way better than perl for example. The parent is the one making an outrage claim (dart is better than every other language they have tried "by a long shot"), so I think the burden of proof in on them.