bartblast
Creator of Hologram
Hey there! ![]()
We need help completing Elixir’s browser runtime by porting some Erlang functions to JavaScript.
Hologram automatically transpiles Elixir, but the underlying Erlang functions - the building blocks of Elixir’s stdlib - must be ported manually.
No Erlang knowledge required - just basic JS/Elixir skills and pattern-following. Tasks: 15 min to a few hours. AI tools encouraged!
Each function you port unlocks multiple Elixir stdlib functions in the browser!
Read the full blog post: https://hologram.page/blog/elixir-to-javascript-porting-initiative
Trending in News & Updates
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
I’m a bit excited to announce that Localize and friends are now at release 1.0. Even though it’s a 1.0 release, it stands on 8 years of w...
New
Hologram v0.11 is out! Two headline features this release. First, Elixir regexes now run in the browser. They were server-only until now,...
New
Just published search_ash 0.5.0 (with search_core 0.4.0) on Hex.
What’s new: synonyms
You can now declare a synonym dictionary per lang...
New
MdexMultilineCells is an MDEx plugin enabling multi-line cells in Markdown tables with full
inline/block Markdown rendering and automati...
New
ActiveMemory 0.8.0 — in-memory tables that speak Ecto
ActiveMemory 0.8.0 is now on Hex.
ActiveMemory is an in-memory store built on ETS ...
New
Bond brings Design by Contract to Elixir: preconditions, postconditions and invariants as executable specifications, checked at runtime a...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
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
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New
Latest Hologram Threads
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Sorc96
I have an idea for a (probably non-trivial) improvement to the test suite. While porting
:erlang.make_tuple/2, I made a mistake and wrote a test checking that making a tuple with size 0 raises an error. This is not true, an empty tuple is returned instead, but the test passed, since my implementation raised an error.Would it be possible to compare the result of the JS implementation with the result of the actual Erlang function? I assume this would require implementing at least one of
term_to_binaryandbinary_to_term. Does this seem too difficult to be worth the effort?bartblast
Thanks for the feedback! Have you seen the “Server-Side Consistency Tests” section in the Contributing Guide? The idea is that you implement matching tests in Elixir (in
test/elixir/hologram/ex_js_consistency/erlang/) that mirror your JavaScript tests. These verify your JS implementation behaves identically to the actual OTP implementation. And if OTP behavior changes in the future, it’ll be caught.Does this resolve the issue for your
:erlang.make_tuple/2case, or should we make this clearer in the docs?Also, could you elaborate on your
term_to_binaryidea? I’m curious what you have in mind.Sorc96
Ah, I misunderstood the point of the Elixir tests. I thought they were run using the JS implementation as well. The actual problem seems to be elsewhere, probably in `assert_error` reporting success even when there is no error. I’m investigating further.
As for the idea regarding comparing the two implementations, I think there would need to be a common serialization format,
term_to_binarybeing the obvious choice. Then, a piece of code could be run both on the BEAM and in JS and the outputs could be compared. This should remove the need for duplicating tests.EDIT: Yes, as far as I can tell,
assert_errordoes not actually check that an error was raised. That explains my confusion when the empty tuple test passed even though there was no error.bartblast
Erlang consistency tests will eventually be automatically transpiled and run on the client. To enable that, we need to port some Erlang functions first (including some from phase 2). For now, matching tests are the simplest and most maintainable way to verify consistency IMO. The same applies to Elixir stdlib tests - they will be transpiled as well eventually to automatically verify consistency.
bartblast
Could you share code snippets that reproduce the problem? I looked at your PR (https://github.com/bartblast/hologram/pull/363/files) and all CI checks pass, including tests using
assert_error. If you have a specific case where it passes when it shouldn’t, please share the test code and what you expected vs. what happened.Sorc96
I fixed the tests in the second commit, but the first commit contains the test that should not be passing.
There is no error when applying the function, it simply returns the empty tuple. Therefore, I would expect the test to fail, since it should assert that an error was raised.
Looking at the definition of
assert_error, I don’t immediately see anything asserting that there was actually an error.bartblast
Allright, I see the problem, fixed it here: https://github.com/bartblast/hologram/commit/482eac4f2fd6e74e2b15de40a221bfe3f3bf3afd
Thank you!
tenkiller
@bartblast I’m curious on your thoughts of what the return value of
re.versionshould be, considering there is not a single version tied to JavaScript Regex capabilities?I simply return an empty bitstring for now, bit this test will always fail.
bartblast
Since JavaScript regexes aren’t compatible with the PCRE standard (which Elixir uses), Hologram will eventually transpile them to maintain compatibility.
For now, please hardcode the JavaScript implementation to return
"8.44 2020-02-12". In both your JavaScript tests and Elixir consistency tests, use this regex pattern to verify the result format:~r/^\d+\.\d+\s+\d{4}-\d{2}-\d{2}$/(this should work in both Elixir and JS)This way both test suites validate the version string format rather than an exact value, which keeps things consistent.
Eventually,
:re.version/0will fetch the PCRE version from the Hologram client-runtime, which will receive it from the server in the initial request. Initially we’ll be targeting a specific PCRE version to ensure consistency across the client-side regex behavior.Thanks for flagging this!
tenkiller
Do we need an implementation of the
Type.set()data type, in order to write functions to operate on them, e.g.:sets.to_list/1?