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
Copy file name to clipboardExpand all lines: content/post/elixirscript-0.30.0-released.md
+18-20Lines changed: 18 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,11 @@ date = 2017-08-09T00:29:03-05:00
4
4
draft = true
5
5
+++
6
6
7
-
ElixirScript 0.30 is a large release with lots of changes. It includes a rewrite of the compiler, a change in JavaScript interoperability and much more. These changes make writing ElixirScript projects feel like writing a normal Elixir project. These changes make this the best release of ElixirScript so far! This is a great point to give ElixirScript a try for yourself. This post will describe the major changes in this version.
8
-
9
-
## Erlang 20 and Elixir 1.5 (compiled with Erlang 20) required
10
-
11
-
This release requires the above because it reads debug information from beam files. This is the same information used for `Exception.blame/3` in Elixir 1.5. This means ElixirScript can compile any Elixir module. One benefit is ElixirScript can now compile the actual Elixir standard library. In earlier versions, it had to reimplement the standard library. Sections below describe the other benefits of this.
12
-
13
-
## Can now use normal Elixir dependencies
14
-
15
-
With the above, ElixirScript can also compile your project's dependencies to JavaScript.
16
-
17
-
## ElixirScript-specific packages are now possible
18
-
19
-
This is one of the most exciting changes. It is now possible to create packages that ElixirScript code can use. This is thanks to the changes described above and the new FFI described later. These are normal mix projects which may or may not have FFI modules and some JavaScript files.
20
-
21
-
If creating a Hex package for ElixirScript, please prepend `elixir_script` to your package name. This is so that it is clear your package is to be use with ElixirScript. For example, a React package would be named `elixir_script_react`. [Here is an example](https://github.com/elixirscript/elixirscript_react).
7
+
ElixirScript 0.30 is a large release with lots of changes. It includes a rewrite of the compiler, a change in JavaScript interoperability and much more. This is also the first version to require Erlang 20 and Elixir 1.5, compiled with Erlang 20. Writing ElixirScript projects feel more like writing a normal Elixir project. These changes make this the best release of ElixirScript so far! This is a great point to give ElixirScript a try for yourself. This post will describe the major changes in this version.
22
8
23
9
## Foreign Function Interface (FFI)
24
10
25
-
JavaScript interoperability has changed in this version. ElixirScript now interacts with JavaScript using an FFI. This allows for a stricter barrier between Elixir code and JavaScript. It also allows for the ability to make packages. Another benefit is that there are far fewer warnings during compilation time. As an example let's create an FFI module for some HTTP specific functions we want to use from JavaScript. An FFI module has 2 parts: the Elixir module and the corresponding JavaScript module.
11
+
JavaScript interoperability has changed in this version. ElixirScript now interacts with JavaScript using an FFI. This allows for a stricter barrier between Elixir code and JavaScript. It also allows for the ability to make packages designed to work with ElixirScript. Another benefit is that there are far fewer warnings during compilation time. As an example let's create an FFI module for some HTTP specific functions we want to use from JavaScript. An FFI module has 2 parts: the Elixir module and the corresponding JavaScript module.
26
12
27
13
Our Elixir module, `MyApp.Http`
28
14
```elixir
@@ -55,22 +41,34 @@ With the above in place, you can call functions on `MyApp.Http` as you would any
55
41
56
42
For more information, check the documentation for `ElixirScript.FFI`.
57
43
58
-
## Limitations
44
+
## Dependencies
59
45
60
-
`receive` is still not supported. When ElixirScript encounters a `receive` call during compilation, the compiler will show a warning, but will continue. During runtime these calls will throw an error. With `receive` not yet supported, this also means most of OTP is not supported as well.
46
+
ElixirScript can compile your project's dependencies to JavaScript. This means you can use many of your favorite Hex packages in ElixirScript code. It is also now possible to create packages that ElixirScript code can use. These are normal mix projects which may or may not have FFI modules with their corresponding JavaScript files.
47
+
48
+
If creating a Hex package for ElixirScript, please prepend `elixir_script` to your package name. This is so that it is clear your package is to be use with ElixirScript. For example, a React package would be named `elixir_script_react`. [Here is an example](https://github.com/elixirscript/elixirscript_react).
61
49
62
50
## A Call to Arms
63
51
64
52
Calls to Erlang functions that the Elixir standard library make have to be reimplemented in JavaScript. There are many that are implemented, but there are more that need to be. This effects the availability of some Elixir standard library calls. A major contribution to ElixirScript would be to help with an implementation of an Erlang function that is blocking the use of an Elixir function you want to use!
65
53
66
54
## Breaking Changes
67
55
68
-
ElixirScript now only works as a mix compiler. This means there will no longer be an escript for download and plugins for Brunch and Webpack will no longer work with this and future versions as well.
56
+
ElixirScript now only works as a mix compiler. This means there will no longer be an escript for download and plugins for Brunch and Webpack will no longer work with this and future versions.
69
57
70
58
ElixirScript now only supports output of ES modules. This is mainly so that there is no confusion about how to implement the JavaScript portion of FFI modules.
71
59
60
+
## Limitations
61
+
62
+
`receive` is still not supported. When ElixirScript encounters a `receive` call during compilation, the compiler will show a warning, but will continue. During runtime these calls will throw an error. With `receive` not yet supported, this also means most of OTP is not supported as well.
63
+
72
64
## Conclusion
73
65
74
-
For more information regarding changes, please check the [changelog](https://github.com/elixirscript/elixirscript/blob/master/CHANGELOG.md). For more information about how to get started, the FFI, and other things, check out the [docs](https://hexdocs.pm/elixir_script)
66
+
For more information regarding changes, please check the [changelog](https://github.com/elixirscript/elixirscript/blob/master/CHANGELOG.md).
67
+
68
+
For more information on getting started with ElixirScript, check the [ElixirScript documentation](https://hexdocs.pm/elixir_script/ElixirScript.html)
69
+
70
+
For more information on FFI, and other things, check out the [FFI documentation](https://hexdocs.pm/elixir_script/ElixirScript.FFI.html)
71
+
72
+
For more information on JavaScript Interoperability, check out the [JavaScript interoperability documentation](https://hexdocs.pm/elixir_script/JavaScriptInterop.md)
75
73
76
74
Finally, I want to give a great big thanks to the Elixir Core Team! Thanks for making the updates in Erlang and Elixir that allowed ElixirScript's progress to continue. And thank you for being available to answer questions and to give great advice!
0 commit comments