Live data from Hacker News

Ask HN: Is Erlang an albatross to Elixir adoption?

news.ycombinator.com

81–90 of 109 posts

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#81

Earlier quoted context omitted.

Phoenix seems quite bloated. Is there any way to make it work without JavaScript, or do I have to rely on it? I really wanted a web framework where I can have routers, templates, sessions, and the usual stuff and no JavaScript, only if I write it myself into the template. :(

`mix phx.new foo --no-live` does that. LiveView is completely optional. Node/npm has been completely replaced by esbuild and even that is optional if you want to rip it out and handle assets another way.

Yeah, I suppose that is why I thought it required JavaScript (the book instructed me to type --live). I was following the instructions of some books and there was JavaScript such as utils.js and whatnot.

I typed what you told me, but it does have "foo/assets/vendor/topbar.js" and "foo/assets/js/app.js". Not sure what those are though or if they are a necessity. It ends up being "deps/phoenix_html/priv/static/phoenix_html.js" on localhost:4000. Any ideas as to how to COMPLETELY avoid JavaScript? Are there any sources for that perhaps?

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#82
post #78

Earlier quoted context omitted.

Phoenix seems quite bloated. Is there any way to make it work without JavaScript, or do I have to rely on it? I really wanted a web framework where I can have routers, templates, sessions, and the usual stuff and no JavaScript, only if I write it myself into the template. :(

There’s no JavaScript unless you write it into the template. If you want to use LiveView that needs JavaScript but plain old templates do not. As for bloat I don’t really agree but I can see how it might appear that way. Phoenix is actually not monolithic, it is sort of just a set of conventions and macros (batteries) that make using Plug and Ecto and some other libraries together more cohesive and more like programm…

Got any resources for simple usages of Phoenix? Most of them are all about LiveView and a lot of stuff that uses JavaScript.

> There’s no JavaScript unless you write it into the template.

I want this. How do I achieve this? "mix phx.new" is not it, as there are JavaScript files in "assets/", for example.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#83
post #78

Earlier quoted context omitted.

Phoenix seems quite bloated. Is there any way to make it work without JavaScript, or do I have to rely on it? I really wanted a web framework where I can have routers, templates, sessions, and the usual stuff and no JavaScript, only if I write it myself into the template. :(

There’s no JavaScript unless you write it into the template. If you want to use LiveView that needs JavaScript but plain old templates do not. As for bloat I don’t really agree but I can see how it might appear that way. Phoenix is actually not monolithic, it is sort of just a set of conventions and macros (batteries) that make using Plug and Ecto and some other libraries together more cohesive and more like programm…

[deleted]

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#84

Earlier quoted context omitted.

Erlang excels at the 'hard' parts of the problem space having to do with complex distributed ultra reliable systems, the 'number crunching' bits are offloaded to specialist languages because the underlying language model that Erlang uses does not lend itself for the kind of optimization that JS, Go, PHP etc have available to them simply because their runtime model is so completely different. The biggest issue from wh…

> the 'number crunching' bits are offloaded to specialist languages because the underlying language model that Erlang uses does not lend itself for the kind of optimization that JS, Go, PHP etc have available to them simply because their runtime model is so completely different. Yeah I love Erlang, but often reach for something else when I need to be able to express and optimize compute bound problems.

In a way it makes perfect sense. When I look into my toolbox I see a whole pile of different saws, each of which has a specific usecase, metal, wood, living wood, trees, joinery, figure work, glass+ etc. The one-tool-to-fit-all-usecases programming language hasn't been invented yet as far as I can see.

+ technically, probably more of a grinder because the blade is covered with diamond dust, but you use it like a saw.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#85
post #3

I feel like this is an issue with all superset languages or however you want to call them and should be taken into account by anyone learning one of these. You can't really learn Elixir without also learning _some_ Erlang, you can't really learn TypeScript without learning some Javascript, you can't really learn Clojure without picking up some Java. The platform/base language is abstracted away to some extent but not…

I've been happily using Clojure for about 9 years and hardly ever have I needed to dip into any Java code. That's not to say I can't grok Java if I need to. Compared with the monstrosity that is Gradle deps.edn is a breath of fresh air.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#86
post #78

Earlier quoted context omitted.

There’s no JavaScript unless you write it into the template. If you want to use LiveView that needs JavaScript but plain old templates do not. As for bloat I don’t really agree but I can see how it might appear that way. Phoenix is actually not monolithic, it is sort of just a set of conventions and macros (batteries) that make using Plug and Ecto and some other libraries together more cohesive and more like programm…

Got any resources for simple usages of Phoenix? Most of them are all about LiveView and a lot of stuff that uses JavaScript. > There’s no JavaScript unless you write it into the template. I want this. How do I achieve this? "mix phx.new" is not it, as there are JavaScript files in "assets/", for example.

You pass the `--no-assets` flag when using `mix phx.new`[1]

Also ime, there's not many good blog posts or guides around Phoenix that I've seen. The sort of de facto resource would be the Programming Phoenix book. It's well worth the $25 considering the amount of effort Chris and co. seems to have put into it.

[1]https://hexdocs.pm/phoenix/Mix.Tasks.Phx.New.html

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#87

> What about people who've tried elixir and moved on? I've tried it three times and it offered me nothing Erlang didn't. Erlang, on the other hand, offers me much that Elixir does not. In truth, I've never met anyone who likes Elixir except people who were already Ruby programmers. What's particularly weird is your attempt to dig at the Erlang docs. They're extracted the exact same way the Elixir ones are; it's just…

> In truth, I've never met anyone who likes Elixir except people who were already Ruby programmers. This was the purpose of the language (or if not an explicit purpose, the primary effect.) Elixir created an environment that attracted Rails people (and other people repulsed by languages that don't look like C/Algol), and behind the Rails people (Rails been long established as a safe choice but aging and scaling badly…

It was not the purpose of the language nor I believe it is its primary effect. It was the immediate effect though.

At last ElixirConf, I remember asking for a show of hands on people's backgrounds, and I would say Ruby was 40-50%. It is impossible to know how it applies to the community as a whole, but I think the idea that Elixir is "Erlang for Ruby" is several years dated at this point.

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#88
post #39

As the creator of Phoenix, I've never written an Erlang program fwiw. That said, I frequent the Erlang docs and most seasoned Elixir developers will do the same because the standard library is a wealth of features, and the documentation while not 2022 polished, remains a remarkable resource. > I don't know what a solution is, but perhaps a concerted effort to create a documentation and library ecosystem that never li…

Highlighting an important distinction Chris makes: there's a huge difference between needing to learn to read/understand the basic syntax of a language and needing to learn to write it. When writing Elixir, yes, you'll be exposed to Erlang syntax/docs sooner or later. But you're not writing Erlang, so you never need to learn how to: - Compile more than a couple lines of Erlang into a function - Create an Erlang modul…

This.

I was able to read Erlang before knowing the name of the language. I discovered this language by looking at the source code of RabbitMQ, and I was surprised at how I could read it, knowing nothing about the language.

At first I thought atoms were variables defined somewhere (and I did not care where it was defined, the names were explicit). When I learned that they are in fact values, it blew my mind.

It's only 6 months later I started coding in Erlang. Then 3 years ago I started writing Elixir. I did not have to learn Elixir in fact, it was just another syntax for what I already knew.

I always recommend learning Erlang first with https://learnyousomeerlang.com/ and then learning Elixir. Simply because this book does a far better job at explaining OTP than the Elixir docs.

Maybe there is some value in writing learnyousomeelixir.com?

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#89

My N00b take on Elixir in general (were N00B = Have my first app, an MQTT/API bridge written and deployed running on Ubuntu employing Bandit, Finch, Tortoise, OpenAPISpex, and Jason). The immediate answer would be no. I would say 5%-15% of my questions asked on the Slack channel have ended up in Erlang land. The first time someone answered with "you want :binary.bin_to_list()", I was completely confused. "What is :bi…

This is fantastic feedback. I always love reading posts like yours. Three quick notes to complement what you said:

* The formatter is always a balancing act. The behaviour you see is because people get really upset when we don't respect their line breaks (and, as you correctly said, we can't later know which newlines were introduced by us). You can try formatting more frequently to get feedback sooner (that's what I do: I usually type code with no indentation whatsoever and "collaborate" with the formatter as I go).

* I am thinking really hard about the struct problem and trying to find a balance between getting some of the guarantees of structs without having to hijack a whole module.

* Re namespaces, agreed they are not as powerful as namespaces in other languages, because they are not actual entities. However, you shouldn't run into issues. If you do recall what it was, feel free to reach out or post something in the forum. The dot notation can be useful in aliases (which a different separator would not help).

Have a good week!

Re: Ask HN: Is Erlang an albatross to Elixir adoption?

#90
post #86

Earlier quoted context omitted.

Got any resources for simple usages of Phoenix? Most of them are all about LiveView and a lot of stuff that uses JavaScript. > There’s no JavaScript unless you write it into the template. I want this. How do I achieve this? "mix phx.new" is not it, as there are JavaScript files in "assets/", for example.

You pass the `--no-assets` flag when using `mix phx.new`[1] Also ime, there's not many good blog posts or guides around Phoenix that I've seen. The sort of de facto resource would be the Programming Phoenix book. It's well worth the $25 considering the amount of effort Chris and co. seems to have put into it. [1] https://hexdocs.pm/phoenix/Mix.Tasks.Phx.New.html

Thank you! Will give it a go. :)
Post reply on HN