4 ms·
Is there a functional language that compiles to Dart? There’s a difference between FP features & FP ergonomics. This seems like a very verbose way to go about t
by toastal 3y ago
Is there a functional language that compiles to Dart? There’s a difference between FP features & FP ergonomics. This seems like a very verbose way to go about things I’m used to being simple/easy.
- zogrodea 3y agoF# is meant to, via Fable. I don't know what the progress is there. https://fable.io/blog/2022/2022-06-06-Snake_Island_alpha.html https://fable.io/blog/2022/2022-06-06-Snake_Island_alpha.htm...
- ollysb 3y agoWow this looks great. One to watch for the future.
- bmitc 3y agoFable is cool, but I worry about its longevity.
- gsuuon 3y agoWhy do you say that?
- bmitc 3y agoStuff like this: https://github.com/fable-compiler/Fable/issues/1822 https://github.com/fable-compiler/Fable/issues/1822 And this Flutter binding launched a year ago by one person and then never touched again: https://github.com/fable-compiler/Fable.Flutter https://github.com/fable-compiler/Fable.Flutter It just seems like an incredibly ambitious project that appears to have very little equal but is mainly worked on by a handful of people but no corporate backing. I get the feeling that if you want to use it, you'll either be the only one doing what you're doing or among just a few people. I already use F# and feel this way about the core language itself.
- gsuuon 3y ago> you'll either be the only one doing what you're doing or among just a few people Agreed.. I've definitely Googled an issue I got stuck on only to land back on my own post (lol). You need fewer people for the same amount of complexity with F#, but idk if that's somehow just translating to fewer people period?
- tym0 3y agoThere's a Clojure for Dart I believe.
- Ketan-fullstack 3y agoyes, though it doesn’t yet have a REPL but the hot reloading works great
- nightwolf 3y agoThere is indeed: https://github.com/Tensegritics/ClojureDart https://github.com/Tensegritics/ClojureDart
- ollysb 3y agoI've been working with Elixir and Elm the last few years but recently have been working on a mobile app in Flutter. While the recent changes are a good step in the right direction (being able to express ADTs and records) it does feel like an iteration away from being ergonomic. Regarding sealed types, I'm not really sure why you'd choose these over type unions, in practice they're often used to describe things like events for reducers and using sealed is incredibly verbose compared to the equivalent in for instance typescript. type Message = | { type: 'IncrementBy', value: number } | { type: 'DecrementBy', value: number } | { type: 'Set', value: number }; vs sealed class Message {} class IncrementBy extends Message { final int value; IncrementBy(this.value); } class DecrementBy extends Message { final int value; DecrementBy(this.value); } class Set extends Message { final int value; Set(this.value); } In a real app this noise really adds up making it difficult to get an overview of the types. Record types are nearly there, but currently there isn't a way to update the records which really hobbles them in day to day use (it looks there will be record spreading coming though so this is hopefully temporary).
- mraleph 3y ago[disclaimer: I work on Dart, though not on the language team] With primary constructors this will become something along the lines of: sealed class Message(); class IncrementBy(final int value) extends Message; class DecrementBy(final int value) extends Message; class Set(final int value) extends Message; Which is considerably less repetitive, though `extends Message` is still there. I am fairly optimistic that the next step would be to eliminate that[1], though I think we would need to gather a bit more feedback from users as people are getting more and more reps in with Dart 3.0 features. I personally would prefer something along the lines of: sealed class Message() { case IncrementBy(final int value); case DecrementBy(final int value); case Set(final int value); } Current syntax is not all that bad if you are going to do OO and add various helper methods on `Message` and its subclasses, but if you just want to define your data and no behavior / helpers - then it is exceedingly verbose. [1]: https://github.com/dart-lang/language/issues/3021 https://github.com/dart-lang/language/issues/3021
- bb86754 3y agoF# has something called Fable. It originally just compiled down to JavaScript. Recently they've added Python and Dart.