kanishka
I have been brainstorming ways to share code between elm and elixir, might use it at work. Think some simple calculations like calculating price based on float input and some constants. Some options:
- Rust, wasm, rustler
- Gleam
- Elixir / Erlang compile to js (haven’t found an active project)
- Implement small DSL that serializes to json and interpret in each language
- Use python (an existing language used in our stack elsewhere), ffi to python from elixir; brython or other python to js compiler
- Don’t use shared language, just use a data driven test set in both languages to guarantee equivalent functionality
Other ideas? Most viable?
I am guessing rust is most viable.
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
The obligatory hello world thread!
Who are you and where are you from? :stuck_out_tongue:
New
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.
My initial shotgu...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
Is there a word for the ~> symbol used in Version strings?
Do you also just call it a Squiggle Arrow™ ?!
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First 10 of 13 Posts
D4no0
I mean why you would use a native interface if elm is used for frontend anyway, once you go over the network there is no reason to use anything beside https.
kanishka
I assume you are suggesting making a network call to the backend to invoke the logic. I wanted something that could respond quickly (as checkboxes are clicked and unclicked, in a long form), so I didn’t keep “call the elixir backend” as an option for this case.
D4no0
You never mentioned where the infrastructure will be located, if you plan on making a local application where you embed elixir and elm on same machine, then using some of your options might be possible (even though they don’t make much sense, there will be no visible performance gain).
If you need an active communication channel between server and client, then just use websockets. There is the phoenix_channels library that abstracts a messaging interface and luckily there is a client in elm also (if that doesn’t work well you can always use the official JS client), however at this point I would just use liveview as it already does what you want to implement from scratch.
hst337
Why do you want to share code? Share data! Use livejson!
marcin
I am trying an approach to use Gleam compiled to JS for FE and re-use it in a Phoenix app on the backend.
see: Regretting/Questioning my current stack Flutter + Elixir as solo dev for mobile app - #21 by marcin
kanishka
Let’s say Amazon us east data center for backend, and California for client browser. Want library function calls (or network calls) to complete within 500 ms. I guess a websocket could support that need. We already use phoenix channels through elm on some pages.
kanishka
After websocket, gleam was my favorite choice, but I figured rust is more mature at this moment.
kanishka
Liveview isn’t really viable for a single page amongst dozens when you have a lot already implemented in an elm SPA.
marcin
So you will be using Rust on WASM, right? Is there some FE framework you’d use to manipulate the DOM ?
mpope
Maybe ElixirScript would be useful, but I don’t know if it guarantees consistency between calculations done in JS in a browser and an Elixir backend. (It also hasn’t had a commit since 2019)