3 ms·
This is really impressive. I’ve never written Dart but this makes me very interested to give it a trial. A sound type system, pattern matching, nice syntax and
by steve_adams_86 4y ago
This is really impressive. I’ve never written Dart but this makes me very interested to give it a trial. A sound type system, pattern matching, nice syntax and seemingly solid tooling — why don’t I hear about this more often?
I’ve been working with state charts a lot and being able to target multiple platforms with the same code would make what I’m doing so much more useful. This library seems to support everything I need: https://github.com/rows/automata https://github.com/rows/automata
Maybe a good side project! Can anyone give reasons why someone should/shouldn’t write Dart (besides a smaller ecosystem)?
- Dig1t 4y ago>why don’t I hear about this more often? Honestly, I think it’s just because the language is a solution in search of a problem. It doesn’t do anything significantly better than any other language and so there’s no reason for it to get traction. I agree it’s pretty decent though, it could have been what Typescript has become but it failed for some reason.
- flooow 4y agoDart 1.0 was a fully-fledged Java-like type-unsafe OOP thing, released at just the time when such things were becoming unfashionable (for good reasons). There was clearly a time where Google could have, and should have, killed it, but instead they decided to keep it alive and make it a core part of Flutter (Lord knows what internal politics lead to this decision). It appears that since then, just like Golang, Google has decided to plough incredible resources into turning a bad language into an OKish one. Meanwhile the world moves on. The flutter site contains a very unconvincing explanation of why it uses Dart [1]. Unconvincing in the sense that the reasons given do not add up to a reason why a very niche language should be kept alive when many other languages would do just fine (Kotlin seems like the most obvious choice). [1] https://docs.flutter.dev/resources/faq#why-did-flutter-choose-to-use-dart https://docs.flutter.dev/resources/faq#why-did-flutter-choos...
- mdhb 4y agoIt seems like your comment and a bunch of the others below it are approximately a decade out of date which is about as old as the language itself just so you know. A huge amount has changed since then.
- pjmlp 4y agoWe kind of know what internal politics lead to this decision, Dart 1.0 was rescued by Ad Words team, as they had just migrated from GWT into AngularDart as Chrome was ramping down their relation with Dart. Had it not been for Ad Words team, Dart wouldn't have been used for Flutter.
- PedroBatista 4y agoThe reason was because Google at the time wanted to kill JavaScript and Dart was their weapon. Around that time Google launched a few “initiatives” to build a “better and more efficient” web. AMP was later but the same spirit and of course all of this was a dystopian nightmare so people got scared and mostly ignored Google. Dart only exists today as an actively developed language because of Flutter.
- cromwellian 4y agohttps://gist.github.com/paulmillr/1208618 https://gist.github.com/paulmillr/1208618
- deleted 4y ago[deleted]
- PedroBatista 4y ago> "The goal of the Dash effort is ultimately to replace JavaScript as the lingua franca of web development on the open web platform. We will proactively evangelize Dash with web developers and all other browser vendors and actively push for its standardization and adoption across the board. This will be a difficult effort requiring finesse and determination, but we are committed to doing everything possible to help it succeed."
- nailer 4y agoThe sad thing is, around 2010, most of the JS world (at least JSconf people, which tend to be pretty influential) were interested in Dash as a JS replacement. We were aware of various inconsistencies around typing, Arrays being fancy Objects, the language allowing developers to do weird things rather than warning, type coersion in == etc. There was an appetite for better languages, CoffeeScript was big. Then they released a 1.0 with zero consultation about what JS developers wanted. Just inflicted by Google as "here's what you'll have". Everyone ignored Dash (and still ignores Dart).
- canadianfella 4y ago
- mhoad 4y agoHistorically there was always a bit of a funky story about what JS <-> Dart interop looked like that made it not a particularly practical option for most people. That is about to change however examples here https://youtu.be/yRlwOdCK7Ho https://youtu.be/yRlwOdCK7Ho 28:30 mark) But the fact that unlike Typescript it will now also natively target WASM along with the fact that it’s generally a much more pleasant language to use I hope it starts to get much more serious consideration moving forward. Simple example here looking at Mixins (a fairly basic pattern to describe any kind of a “is-a” rather than a “has-a” relationship in OOP). Here’s TypeScript https://media.infosec.exchange/infosecmediaeu/media_attachments/files/110/267/005/251/685/190/original/6cd93343daba7402.jpeg https://media.infosec.exchange/infosecmediaeu/media_attachme... Here’s Dart https://media.infosec.exchange/infosecmediaeu/media_attachments/files/110/267/005/250/857/204/original/2a45b0723405c06d.jpeg https://media.infosec.exchange/infosecmediaeu/media_attachme...
- markdog12 4y ago> That is about to change however examples here https://youtu.be/yRlwOdCK7Ho https://youtu.be/yRlwOdCK7Ho 28:30 mark) But it doesn't explain what js.window IS. I assume it's implemented via static interop (https://pub.dev/packages/js#staticinterop https://pub.dev/packages/js#staticinterop), but not sure. Is it out of some secret library they have somewhere, generated from Web IDL? Do I have to implement every function/property on window myself via static interop? Btw, you can link to youtube with a timestamp: https://youtu.be/yRlwOdCK7Ho?t=1724 https://youtu.be/yRlwOdCK7Ho?t=1724 Update: I did find this package, which seems to generate bindings from Web IDL: https://pub.dev/packages/js_bindings https://pub.dev/packages/js_bindings, but it's not from the Dart team, and prob not what they're using here.
- mhoad 4y agoWork on that is happening here https://github.com/dart-lang/web https://github.com/dart-lang/web. I expect it will be fully baked by the time Dart 3.1 drops and in-line classes are a thing as it ends up making a big difference as far as I can tell.
- mhoad 4y agoThis might also be worth taking a look at, it was extracted from the Stadia codebase when that shut down https://github.com/google/hierarchical-state-machine.dart https://github.com/google/hierarchical-state-machine.dart
- cromwellian 4y agoKotlin has some pretty nice StateMachine DSL libraries out there, like https://github.com/nsk90/kstatemachine https://github.com/nsk90/kstatemachine