With all the developer excitement following Google I/O this week, we’re keeping in theme with a developer-oriented Fuchsia Friday.
Wherever you may fall in the programming knowledge spectrum, Fuchsia wants to accommodate you, instead of dictating how you are supposed to get the job done. To do this, the Fuchsia Team has created FIDL. FIDL works in two parts, the Fuchsia Interface Definition Language itself, and an underlying system that connects the various languages together.
As of now, FIDL supports 5 languages, with more likely coming in the future
- Go – Another Google language, primarily used in web servers
- C++ / C – Two trusty languages, especially useful for low-level programming
- Rust – Mozilla’s relatively successful attempt at a replacement for C++
Let’s say you write a library in Go, but want to use it in a Dart (or Flutter) application. You should be able to use the FIDL language to create an ‘interface’ and connect it to your Go code as an ‘implementation.’ The FIDL system will then generate ‘bindings’ for all supported languages, so you can use your Go code in Dart.
Now perhaps some time has passed, you realized that Go wasn’t really the best tool for the job, and decided to rewrite the library in Rust. With FIDL, you should be able to specify your Rust code as the new implementation. That’s it. You’re done. Your Dart code shouldn’t change, because the FIDL interface didn’t change. That’s the simplified version, anyway.
Interestingly, the FIDL system is in such common use in Fuchsia development that the Fuchsia Team has even developed an extension for VS Code to assist in writing better FIDL code.
If you’re interested in learning more about FIDL and how to use it, check out the official tutorial in the Fuchsia documentation. On that page, you can find simple examples of calling C++ code from Dart and vice versa.
Read more in our Fuchsia Friday series:
- Fuchsia Friday: Maxwell and the secret ‘agents’ of Fuchsia
- Fuchsia Friday: The dream team behind Google’s new OS
- Fuchsia Friday: Early thoughts on how Android compatibility could potentially happen
- Fuchsia Friday: The first 5 minutes of Fuchsia as captured by its new screenshot tool
- Fuchsia Friday: Where is Fuchsia at Google I/O 2018?