aboutsummaryrefslogtreecommitdiff
path: root/src/content/chapter5_advanced_features/lesson05_multi_target_externals
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2024-02-20 12:20:16 +0000
committerLouis Pilfold <louis@lpil.uk>2024-02-20 12:20:16 +0000
commit938f49fc7835501192ccc7db7c1ab3174f050b34 (patch)
tree3e515fa15b6812df9947df80b8c16afd20faa436 /src/content/chapter5_advanced_features/lesson05_multi_target_externals
parente7d45ec089262e8b6731ddf87e65a06f4de07841 (diff)
downloadtour-938f49fc7835501192ccc7db7c1ab3174f050b34.tar.gz
tour-938f49fc7835501192ccc7db7c1ab3174f050b34.zip
Let assert
Diffstat (limited to 'src/content/chapter5_advanced_features/lesson05_multi_target_externals')
-rw-r--r--src/content/chapter5_advanced_features/lesson05_multi_target_externals/code.gleam11
-rw-r--r--src/content/chapter5_advanced_features/lesson05_multi_target_externals/en.html22
2 files changed, 0 insertions, 33 deletions
diff --git a/src/content/chapter5_advanced_features/lesson05_multi_target_externals/code.gleam b/src/content/chapter5_advanced_features/lesson05_multi_target_externals/code.gleam
deleted file mode 100644
index b62a735..0000000
--- a/src/content/chapter5_advanced_features/lesson05_multi_target_externals/code.gleam
+++ /dev/null
@@ -1,11 +0,0 @@
-import gleam/io
-
-pub type DateTime
-
-@external(erlang, "calendar", "local_time")
-@external(javascript, "./my_package_ffi.mjs", "now")
-pub fn now() -> DateTime
-
-pub fn main() {
- io.debug(now())
-}
diff --git a/src/content/chapter5_advanced_features/lesson05_multi_target_externals/en.html b/src/content/chapter5_advanced_features/lesson05_multi_target_externals/en.html
deleted file mode 100644
index 6e02d36..0000000
--- a/src/content/chapter5_advanced_features/lesson05_multi_target_externals/en.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<p>
- Multiple external implementations can be specified for the same function,
- enabling the function to work on both Erlang and JavaScript.
-</p>
-<p>
- If a function doesn't have an implementation for the currently compiled-for
- target then the compiler will return an error.
-</p>
-<p>
- You should try to implement functions for all targets, but this isn't always
- possible due to incompatibilities in how IO and concurreny works in Erlang and
- JavaScript. With Erlang concurrent IO is handled transparently by the runtime,
- while in JavaScript concurrent IO requires the use of promises or callbacks.
- If your code uses the Erlang style it is typically not possible to implement
- in JavaScript, while if callbacks are used then it won't be compatible with
- most Gleam and Erlang code as it forces any code that calls the function to
- also use callbacks.
-</p>
-<p>
- Libraries that make use of concurrent IO will typically have to decide whether
- they support Erlang or JavaScript, and document this in their README.
-</p>