Qqwy
TypeCheck Core Team
Fun with Metaprogramming
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?
Most Liked
Popular in Discussions
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition)
It’s been a while since we first asked this, I...
New
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them?
Feel free to be as concise or in-depth as you li...
New
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
What configs will make sense to put to runtime.exs?
–
A bit of how I configure apps:
I have generic configs in config/config.exs,
dev...
New
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New
https://nitter.net/josevalim/status/1744395345872683471
https://twitter.com/josevalim/status/1744395345872683471
New
Other popular topics
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
Hi All,
I set a environment variables in dev.exs , like below code.
when i start server, how can i set the ${enable} value?
thanks.
d...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Chat & Discussions>Discussions
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









