Recently I found out that you can get rather creative with Elixir’s metaprogramming as its AST lets itself be bent into some fancy shapes.
Use this stuff at your own peril! Don’t say I did not warn you. Your coworkers might lynch you… .
iex> use AtAt
iex> @@@@@@@@@@@@@@@@@@@@@@@self()
"Wow! Running self() with 23 ats!"
#PID<0.85.0>
iex(56)> import Scream
iex(58)> scream!! 42
"You say: 42."
iex(59)> scream!!!!!!!!!!!!!! 'I like trains and I cannot lie'
"You scream: 'I like trains and I cannot lie'!!"
Yes, these are definitely small party tricks, but I had to giggle a little, so I wanted to share these with you because maybe they make someone else giggle as well.
And who knows, maybe they can serve as some kind of inspiration to someone…
Do you guys know any other ways in which Elixir’s AST can be misused?