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
Hello,
I want to share a project I’ve been working on for a while:
https://github.com/almightycouch/gitgud
Background
Some time ago I ...
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
Piggy backing a bit on @dvcrn topic BEAM optimization for functions with static return type?, I’ve been trying to understand in a deeper ...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
Another point that Dave drives home in his course is that applications really are components, and you should treat them as such. Not as “...
New
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
How does the two languages compare when it comes to server side application development? Any experiences or ideas? Thank you.
New
I’m playing with Elixir - It’s fun. I think @rvirding does give Elixir courses these days.
Re: files and database - when I given Erlang ...
New
Since Drab has been developed for a while in the open, introducing the Liveview functionality in a way it happend appears to undermine th...
New
Other popular topics
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
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
- #javascript
- #code-sync
- #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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








