You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there everybody! It's been some time without Fable news but we're bringing you something today that we hope will get you excited :) Today we're announcing the first **alpha** release of Snake Island, codename for Fable 4. If you've been following us on Twitter you'll probably know this the most ambitious Fable release to date, extending the compilation targets for F# beyond JS, and include languages like Python, Rust or Dart. The ultimate goal is to convert F# into a super-powerful DSL you can use to design your programs and algorithms and still have the freedom to choose the platform you want to run your code on. (TODO: Also mention the benefits of interacting with other ecosystem and communities)
12
+
Hey there everybody! It's been some time without Fable news but we're bringing you something today that we hope will get you excited :) Today we're announcing the first **alpha** release of Snake Island, codename for Fable 4. If you've been following us on Twitter you'll probably know this the most ambitious Fable release to date, extending the compilation targets for F# beyond JS, and include languages like Python, Rust or Dart. The ultimate goal is to convert F# into a super-powerful DSL you can use to design your programs and algorithms and still have the freedom to choose the platform you want to run your code on.
13
+
14
+
We also believe that, same as it happened with JS, the interaction with other ecosystems and communities is tremendously beneficial for the F# language and F# developers. Although it makes for a good catch-phrase, Fable wasn't born to make F# "the One to rule them all", instead we'll be most happy if Fable can be a bridge for F# developers to explore other worlds beyond .NET. Some of them have fully crossed the bridge and become Typescript/JS experts. This is great too and we hope it can also happen in the future for Python, Rust or Dart!
13
15
14
16
Please see below for specific details about each of the new language targets and how you can try this one.
15
17
@@ -29,7 +31,20 @@ You can track the current progress for Rust compilation [here](https://github.co
29
31
30
32
## Dart
31
33
32
-
...
34
+
Cross-platform has been the holy grail of app development for a long time. The .NET team is also be very active in this space with [the recent release of MAUI](https://devblogs.microsoft.com/dotnet/introducing-dotnet-maui-one-codebase-many-platforms/), but there's another project that has gained a lot of traction over the years thanks to its high-quality and great development experience: [Flutter](https://flutter.dev/). And with React-inspired [declarative UIs](https://docs.flutter.dev/development/ui/widgets-intro), Flutter's model is very familiar to most Fable developers.
35
+
36
+
Dart, the language used for Flutter, is a typed language, with null-safety and very similar to C# so it's a perfect for F#. There's still work to do, but thanks to the analysis tools in Dart we're polishing the code generation to get a very clean output. We expect to have even better F#-Dart interoperability than we have with JS!
37
+
38
+
You can clone [this repo](https://github.com/alfonsogarciacaro/fable-flutterapp) to try a simple Elmish Todo app running in Dart. Note the app translates the original Elmish code (with small edits) to Dart so it's already quite powerful. Follow the README instructions to start the app, the commands in `build.sh` will start Fable and then you can use a Flutter-compatible IDE (or the [Flutter CLI](https://docs.flutter.dev/get-started/install)) to run and debug Flutter.
39
+
40
+
When writing your own code for Dart compilation please note the following:
41
+
42
+
- Dart has null safety, so the compiler may complain, e.g. when assigning null to a string, even if this is possible in F#. For this reason, `Unchecked.default<_>` won't work in many cases, although you can use it to initialize a mutable variable (Fable translates this is an empty `late` var in Dart).
43
+
- For now, we are compiling F# options as Dart nullables. It's working well and plays nicely with Dart native code, but it has a limitation: you cannot have nested options (be careful also with generic options). We may change the F# option representation if this proves to be too limiting.
44
+
- If Dart compiler complains about generics inferred by F#, try adding type annotations to your F# code.
45
+
- At the time of writing, print formatting with `(s)printf` is not supported. Use string interpolation and `Fable.Core.Dart.print` instead.
46
+
47
+
Besides the missing code and library features, the biggest challenge for writing Flutter apps with F# is to have proper bindings for the enormous Flutter widget library. We're working to find a way to do it in a (semi)automated way as we have with ts2fable. [Any help is appreciated!](https://github.com/fable-compiler/Fable/issues/2878)
33
48
34
49
You can track the current progress for Dart compilation [here](https://github.com/fable-compiler/Fable/issues/2877).
0 commit comments