Not Elixir, but OTP is the magic that makes Elixir happen. So, for me OTP!
I think that bunching all the functions clauses together in one unit is better, it pushes the idea that this is one function and shows more clearly all the bits which comprise the function. Otherwise, in the worst case, you may need to scan the whole module to find the function clauses. I know this is not encouraged but it is legal. Or has it been changed now? However writing macros becomes easier if you can split the function clauses.
And yes, I am influenced by my past with Erlang.
I entirely agree, that is why I like how OCaml does it, a ‘multi-head test’ is done via the
let someFunc = function | Blah x -> string_of_int x | Vwoop 0 -> "invalid" | Vwoop x when x<0 -> "Lower Vwoop" | Vwoop x -> "Vwoop" | ...
Elixir does still require function clauses to be together though, but otherwise they ‘look’ like separate function definitions. Of course macro’s and
super change all that up too. ^.^
super means that a function was
defoverrideable theFunction... first, which means that each function internally gets a unique name, and when the module is finally compiled the ‘last’ one defined gets the real name, and the ‘super’ call inside it just delegates to the previously named one. Interesting method to work around the one-definition rule, though again I still like how OCaml does it:
let someFunc x -> x * 2 (* This references the previously defined function *) let someFunc x -> 2 + someFunc x (* The `rec` completely hides prior definitions, instead this references itself *) let rec someFunc x -> if x <= 0 then 0 else someFunc (x-1)
Who said, flattery does not pay
Haha! Well, a little bit of gratitude does not hurt, right?
And I’m being sincere btw. I really think this forum makes Elixir even better and easy to adopt…
It’s the second most liked post in this thread so we can’t be doing too badly Robert
And yes, it does pay the more you love the forum the more incentivised we are to get you lots of cool prizes and juicy discounts …and we’ve got some awesome stuff for 2018!
(But more on that in our New Year announcement - which I’m running a bit late with sorry - New Years, my birthday, and my mum’s birthday all in one week! Hopefully have it all done by next week though )
also because I liked it too
I could not agree more. The Elixir community is second to none, much like its VM
I don’t know if i answered it before or not.
Pipe operator, no, pattern matching, no, multi clause functions, no, otp, no, ruby like syntax, no, Phoenix, no, Ecto, no, ElixirForum.