Sgoettschkes
How are anonymous functions represented internally?
I recently came across the explanation for remote code execution in Elixir, using a base64 encoded payload, which is encoded and passed to binary_to_term/2.
I understand the steps taken and the problem with binary_to_term. What I do not understand and what interests me is how anonymous functions are represented internally for this to work. For example, this code snipped somehow works, but I have no clear understanding of why and how:
Enum.zip(fn _x, _y -> {:cont, []} end)
It would be highly appreciated if anybody has any good resources or an explanation. Thanks!
Most Liked
benhaney
I’m not exactly sure what you’re looking for with your question about how anonymous functions are represented internally, but the reason your snippet works is simply because the Enumerable protocol is implemented for Function. See elixir/lib/elixir/lib/enum.ex at v1.14 · elixir-lang/elixir · GitHub
Popular in Questions
Other popular topics
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








