sodapopcan
Discrepancies with elixirc and mix compile
It’s come up a few times recently how the following code snippets are equivalent when compiled:
def Foo do
def foo do
String.capitalize("foo")
end
end
and
def Foo do
import String
def foo do
capitalize("foo")
end
end
I’m not questioning how this works or anything, I understand the latter essentially gets rewritten to the former. However, when compiling each with elixirc, the resulting binaries are not only different but one is a slightly larger than the other (we’re only talking a few bytes here). But when put into a mix project and compiled with mix compile, the binaries are the same size, but still differ (no difference if compiled in dev or prod or as a release). I’m assuming this is just the @vsn attribute, but clearly I don’t actually know.
What gives?
EDIT: If this is even a valid test, I manually set @vsn and they still differed in mix.
First Post!
sodapopcan
I still haven’t figure this out so I’m giving it a single weekday bump.
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








