Earlier quoted context omitted.
I'm a huge elixir fan, but in micro made up benchmarks I consistently see Ruby win over Elixir. I haven't run it with the jit. One specific case that cripples Elixir - is as far as I know Elixir can't handle large multiplications efficiently. Ruby, Python use karatsuba or some derivative - from what I can tell multiplication in Erlang doesn't. Though I haven't actually asked anyone and was just poking around on my ow…
I was curious to see what my JIT build looked like for me so I ran the following: https://gist.github.com/cararemixed/c232b888b9dbdaeb67967f35... This shows a significantly different story between the two with at least similar code. Note I am not trying to optimize for the fastest factorial here as both can be made much quicker but roughly equivalent code seems to tell a different story for me. (NOTE: I put the code…
Elixir and Phoenix after two years
81–90 of 111 posts
Re: Elixir and Phoenix after two years
#82i'm not a web developer but enjoy paying attention to this space from the sidelines. elixir and phoenix are wonderful. the phoenix liveview is a fantastic piece of technology; it moves the processing to the backend and allows the web application to be developed in the same language (mostly). i just recently discovered microsoft blazor and it seems like it's an even better improvement. compared to liveview, the comput…
I'm an Elixir developer, and I love the language, but I'm not sold on Phoenix LiveView. It sounds really cool, but it seems like there are too many edge cases. How do you scale it horizontally? What happens to user state when a connection is dropped? What do you do when you get a business requirement that hits one of LiveView's pain points? What if you have to swap out your backend for business reasons, and now you h…
https://elixirforum.com/t/phoenix-channels-horizontal-scalab...
https://www.phoenixframework.org/blog/the-road-to-2-million-...
Re: Elixir and Phoenix after two years
#83Earlier quoted context omitted.
> and perhaps there could be a more concise enhancement of Erlang which would get the job done Erlang already is a more concise language than Elixir but also noisier as there are more punctuation characters. I would love if Erlang would drop some of its punctuation, as some of it is frankly unnecessary. Elixir syntax is definitely simpler than Ruby’s. Probably in the same ballpark as Python complexity wise: Elixir ha…
> Erlang already is a more concise language than Elixir but also noisier as there are more punctuation characters. What? Here's more-or-less the entirety of Erlang's "noisier syntax with more punctuation characters" -spec f(A :: any(), B :: some_type(), C :: list()) -> any(). f(A, {B}, [C | _]) -> A1 = fun() -> io:format(a, []) end, A1(), case C of > -> 1; _ -> #person{ok = ok, field = C} end. Edit: %% plus map synta…
You are conveniently not showing many examples where Elixir is considerably less noisier such as keywords, utf-8 binary strings, etc. Module definitions in Erlang use -(). while Elixir doesn’t use a single punctuation character. Erlang has special syntax for list and binary comprehensions while Elixir has unified both and uses no special syntax. Maps in Erlang also have two syntaxes, more ways of doing try/catch, etc.
If you take examples of actual code implemented in both languages, instead of cherry-picked invalid gibberish, you will find that Erlang has more punctuation per character than Elixir.
Re: Elixir and Phoenix after two years
#84Re: Elixir and Phoenix after two years
#85Earlier quoted context omitted.
> Erlang already is a more concise language than Elixir but also noisier as there are more punctuation characters. What? Here's more-or-less the entirety of Erlang's "noisier syntax with more punctuation characters" -spec f(A :: any(), B :: some_type(), C :: list()) -> any(). f(A, {B}, [C | _]) -> A1 = fun() -> io:format(a, []) end, A1(), case C of > -> 1; _ -> #person{ok = ok, field = C} end. Edit: %% plus map synta…
My god, it’s like Perl but somehow worse. How do you even keep track of what’s going on?
Re: Elixir and Phoenix after two years
#86Earlier quoted context omitted.
I just implemented a thing for work in very bare Phoenix Liveview. It integrates with Plaid. I definitely needed hooks and about 200 lines of JS to get it working. You can't completely kill JS, yet, unfortunately.
Was it your integration with Plaid that required the 200 lines of JavaScript? I've spent the last year building out a web application for service providers to use to manage disaster recovery software for multiple clients using Elixir, Phoenix, LiveView, and TailwindCSS. We haven't used a single line of JavaScript code, including for the Tailwind components that typically rely on JavaScript to function. LiveView has b…
I wish I could have better integrated tests with the javascript, but considering, the live view suite of tests is really quite good.
Re: Elixir and Phoenix after two years
#87Earlier quoted context omitted.
> Erlang already is a more concise language than Elixir but also noisier as there are more punctuation characters. What? Here's more-or-less the entirety of Erlang's "noisier syntax with more punctuation characters" -spec f(A :: any(), B :: some_type(), C :: list()) -> any(). f(A, {B}, [C | _]) -> A1 = fun() -> io:format(a, []) end, A1(), case C of > -> 1; _ -> #person{ok = ok, field = C} end. Edit: %% plus map synta…
Your Elixir example is literally wrong. It won’t compile unless you do many changes. You are keeping -> instead do. You are still using commas after each expression. The fn syntax is wrong and also using parens for args. So you forgot to remove most of the punctuation noise. You are conveniently not showing many examples where Elixir is considerably less noisier such as keywords, utf-8 binary strings, etc. Module def…
I was typing this inside the HN comment box. And no, not many changes.
> So you forgot to remove most of the punctuation noise
For the two examples you could come up with for my entire text Elixir adds half a dozen new punctuation characters on top of Erlang.
> If you take examples of actual code
Of course. Here you go:
Enum.sort(["some", "kind", "of", "monster"], &(byte_size(&1)
I mean, Erlang doesn't even have `&` as a part of syntax, but sure, "Erlang has more punctuation".Besides, Erlang's syntax is significantly more consistent than Elixir's. Just take Elixir's two separate syntaxes for maps, for example. Or the dichotomy between syntax for functions and lambdas (both for declaration and invocation).
The only reason Elixir feels like it has less punctuation is that Erlang is actually more terse than Elixir.
Just having pipes and function captures everywhere makes Elixir code have more punctuation than Erlang.
Re: Elixir and Phoenix after two years
#88Earlier quoted context omitted.
> Erlang already is a more concise language than Elixir but also noisier as there are more punctuation characters. What? Here's more-or-less the entirety of Erlang's "noisier syntax with more punctuation characters" -spec f(A :: any(), B :: some_type(), C :: list()) -> any(). f(A, {B}, [C | _]) -> A1 = fun() -> io:format(a, []) end, A1(), case C of > -> 1; _ -> #person{ok = ok, field = C} end. Edit: %% plus map synta…
you are conviently forgetting one thing: The equivalent of "hello world" in erlang is > Not the best. Keyword lists in erlang are unpretty m:f(value, [{foo, >}, {baz, 47}]) Where in elixir you would do: :m.f(value, foo: "bar", baz: 47)
is "hello world".
Edit:
I know that "" in Elixir is binaries which are > in Erlang. In Erlang "hello world" is really a list of ["h", "e", "l", "l", ...].
What was surprising to me is how rarely that matters (unless you actually do a lot of text processing). And the functions that matter (like I/O) deal with io_lists anyway.
And since strings in Elixir are binaries, when you actually need to work with binaries, you're back to the same/similar syntax:
> == > %% Erlang
> == > ## Elixir
> Keyword lists in erlang are unprettyKeyword lists in Elixir are nice, that's true.
Re: Elixir and Phoenix after two years
#89Earlier quoted context omitted.
> Erlang already is a more concise language than Elixir but also noisier as there are more punctuation characters. What? Here's more-or-less the entirety of Erlang's "noisier syntax with more punctuation characters" -spec f(A :: any(), B :: some_type(), C :: list()) -> any(). f(A, {B}, [C | _]) -> A1 = fun() -> io:format(a, []) end, A1(), case C of > -> 1; _ -> #person{ok = ok, field = C} end. Edit: %% plus map synta…
My god, it’s like Perl but somehow worse. How do you even keep track of what’s going on?
From personal experience:
- You're comfortable with Erlang syntax within half a day. There's just so much less of it
- You're comfortable with Elixir syntax within a day of two of active coding. Function captures may trip you up once or twice more, but then it's fine.
Re: Elixir and Phoenix after two years
#90Earlier quoted context omitted.
Your Elixir example is literally wrong. It won’t compile unless you do many changes. You are keeping -> instead do. You are still using commas after each expression. The fn syntax is wrong and also using parens for args. So you forgot to remove most of the punctuation noise. You are conveniently not showing many examples where Elixir is considerably less noisier such as keywords, utf-8 binary strings, etc. Module def…
> Your Elixir example is literally wrong. It won’t compile unless you do many changes. I was typing this inside the HN comment box. And no, not many changes. > So you forgot to remove most of the punctuation noise For the two examples you could come up with for my entire text Elixir adds half a dozen new punctuation characters on top of Erlang. > If you take examples of actual code Of course. Here you go: Enum.sort([…
lists:sort(
fun(X, Y) -> byte_size(X) >, >, >, >]
).
I will let others decide which one is noisier.(And no, using Erlang strings here is not the same, especially when popular libraries like Hackney and Cowboy work only with binary strings)
> Erlang is actually more terse than Elixir
Which was my point since the beginning but you quoted only part of my reply. It is clear Elixir has more syntax than Erlang. The function definition delimiters (->/.) vs (do/end) is a good example in itself of how Erlang is more compact and using punctuation.
I stand with my position that if you take actual code, a file or a project, and write it in both idiomatic Erlang and Elixir, Erlang will have more punctuation per character and will feel noisier.
Here is an actual example. I got the hex decoding/encoding code recently committed to OTP in Erlang (https://pastebin.com/qMtj8mSY) and rewrote to Elixir (https://pastebin.com/zUCLeXZG). I ran them through the Whatsapp formatter and the Elixir formatter respectively. Both snippets compile and define proper modules. If you remove all whitespace, the rate of punctuation character per alphanumeric character for Erlang is 35%. For Elixir it is 25%. And FWIW, in this particular case, the Elixir implementation has roughly the same amount of characters as the Erlang one: 718 vs 721.
I will be glad to continue this discussion if you want to use actual code instead of fictional examples.
EDIT: I fixed an error in the Erlang snippet and updated the stats.