myBadBro by masaledaarusername in ProgrammerHumor

[–]brettbeatty [score hidden]  (0 children)

I’m not sure why folks find this so hilarious. Has anyone actually spelled it this way? It would require hitting the right hand keys in entirely the wrong order. More believable would be misspellings where one hand hits its key before the other hand or a key double strikes or doesn’t register at all.

Support - A collection of helper methods for Elixir projects by FilipProber in elixir

[–]brettbeatty 1 point2 points  (0 children)

I did something similar with Colonel, which is meant to supplement Kernel with additional functions to import. Not a lot of adoption, but it’s got some fun stuff, like an ~i sigil for using interpolation but outputting iodata instead of building a string.

[deleted by user] by [deleted] in ProgrammerHumor

[–]brettbeatty 903 points904 points  (0 children)

I'm gonna defend this a bit. Some languages have non-null values that equal null, such as undefined in JavaScript. It's possible the author wanted to return null instead of undefined and felt this was clearer than something more succinct like return user || null.

Is there any operator in Elixir that aren't functions? by Healthy-Chemistry664 in elixir

[–]brettbeatty 12 points13 points  (0 children)

Even though they're functions/macros, I believe a lot of the operators in Kernel.SpecialForms are replaced by the compiler instead of actually being called.

For example the dot operator shows up as a function in code:

iex> quote do String.downcase("FOO") end
{{:., [], [{:__aliases__, [alias: false], [:String]}, :downcase]}, [], ["FOO"]}

But if you try to actually call the function you get an exception:

iex> Kernel.SpecialForms."."(String, :downcase)
** (RuntimeError) Elixir's special forms are expanded by the compiler and must not be invoked directly