8 ms·
When two languages have different scoping rules, they don't have the same semantics. When two languages differ in their opinion about macros, they don't have th
by nox_ 12y ago
When two languages have different scoping rules, they don't have the same semantics.
When two languages differ in their opinion about macros, they don't have the same semantics.
When two languages have different semantics, they are different languages.
And finally, when two languages have fundamentally different syntaxes, the idioms promoted by their creators differ, and thus problems are solved in different ways.
They are not fundamentally the same language, no.
- derefr 12y agoErlang and Elixir aren't the same language, but they do share a pretty unique architecture in OTP. When people talk about "the advantages of Erlang" they're frequently really talking about OTP (that, or BEAM's reduction-counting ISA.) So people think it's Erlang that gives you those advantages. Of course, it's not; any language that targets BEAM could pick up those advantages "for free", in the same way Clojure gets a bunch of Java libraries "for free." But people compare programming languages, not abstract machines or library ecosystems. If you treat Erlang and Elixir as black boxes, hiding BEAM and the OTP (the way someone who doesn't know either language would), then they seem to be much more similar to one-another than any other language is to either of them.
- nox_ 12y agoSharing a common subset does not make them "fundamentally the same language".
- pessimizer 12y ago>they seem to be much more similar to one-another than any other language is to either of them.
- MCRed 12y ago"language"
- nox_ 12y agoQuotes don't magically let you say wrong things.
- klibertp 12y agoScoping rules? I what way do they differ? Honest question.
- nox_ 12y agoVariables in Elixir can be rebound, and there are no unsafe variables at all in Elixir.
- klibertp 12y agoI wouldn't call it "scoping" difference, although I can see why one would think about it as such. It would be a real scoping issue if you could assign variables in outer scopes from inside the nested scopes. Can you?
- nox_ 12y agoYou can. And even if you couldn't, what I mentioned is still different scoping rules, whether you put scare quotes or not.
- klibertp 12y ago> what I mentioned is still different scoping rules You're probably right, I don't want to argue about terminology. What do you mean by "scare quotes"? Honest question: English is my second language and I'm not very good with it. > You can. You're wrong. Here, take a look: iex(4)> f = fn() -> a = 0; (fn()->a=9 end).(); a end #Function<20.80484245/0 in :erl_eval.expr/5> iex(5)> f.() 0 f.() should evaluate to 9 if what you said was true. Either there's a special syntax for doing this in Elixir (like nonlocal in Python 3) or it's absent, and then the scoping rules are the same in Elixir and Erlang, with a bit of syntactic sugar for SSA transformation, which you need to do by hand in Erlang. Again, I'm not Elixir programmer, so this is a honest question: is there some special syntax which would make the example above produce 9? I doubt it very much because it wouldn't fit very well with BEAM, but everything is possible and I'd be glad to learn about another nice feature of Elixir.