Coming from JavaScript......
Hey guys! I've been a node dev for years, I absolutely love JavaScript but I cannot seem to grasp the concept around the syntax.
It's weird because I like the syntax, but at the same time my mind keeps fucking going back to JavaScript shit. I'm wondering if anyone here who came from JavaScript and has any tricks to help ease the conversion process?
For example, in JS:
users = {
john: {name: "John", age: 27, languages: ["Erlang", "Ruby", "Elixir"]},
mary: {name: "Mary", age: 29, languages: ["Elixir", "F#", "Clojure"]}
}
But in Elixir:
users = [
john: %{name: "John", age: 27, languages: ["Erlang", "Ruby", "Elixir"]},
mary: %{name: "Mary", age: 29, languages: ["Elixir", "F#", "Clojure"]}
]
Are these basically the same thing? I know Elixir calls them "Nested data structures", which are Maps, is that basically the same as a JavaScript "Object", if you will? This is where my brain gets confused and stuff. It's hard to explain, but I really want to get into Elixir because I heard it takes advantage of all cores on a server for you and is not single threaded like node, which in return offers better performance. And you don't have to spin up multiple processes, etc. So, I'm really eager to learn this language but I just feel like I'm going about it the wrong way. Is it a functional vs OOP approach that I need to adapt to? Sorry this post is all over the place but yeah, thanks if you can help!
Posted May 11, 2016, 8:43 PM UTC