Hacker News new | past | comments | ask | show | jobs | submit login

I'll say Elixir isn't perfect. There are a few annoying bits that won't be changed due to backwards compatibility, that 98% of people won't run into. For example:

    a = [foo: "bar", foo: "baz"]
    Keyword.get(a, :foo)   #==> gives you "bar"
    a[:foo]                #==> gives you "bar"
    my_struct = struct(SomeStructWithFoo, a)
    my_struct.foo          #==> gives you "baz"
But really, this minor, minor inconsistency is near the top of my list of complaints, so... Take that into consideration.

Also, if you start coding in Elixir a lot, you will write better Javascript by importing good practices in from Elixir.




What's the problem there? A map has unique keys, a keyword list is just a list of {atom, term}, so there might be duplication.

They are similar but they are not the same thing and are not to be used in the same places.


The problem is that it violates the principle of least surprise. Thankfully this sort of thing is not rampant in Elixir, and I discovered the example only after something like 50k lines of very joyful code.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: