Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when interpolating a map property #3

Merged
merged 1 commit into from
Apr 17, 2015
Merged

Conversation

danielberkompas
Copy link
Owner

If you interpolate a map property in a verb, like this:

people = [%{name: "Daniel"}, %{name: "Hunter"}]

twiml do
  Enum.each people, fn person ->
    say "Hello, #{person.name}!"
  end
end

You'll get an error. This is because of a funky thing with macro generation, where it tries to figure out if the argument passed into say is a string or not. Since it contains an interpolation, it tries to execute the interpolation, but in the wrong context, where the person.name binding is not set.

Instead, it should pattern match for :<<>>>.

danielberkompas added a commit that referenced this pull request Apr 17, 2015
Error when interpolating a map property
@danielberkompas danielberkompas merged commit cd28d6c into master Apr 17, 2015
@danielberkompas danielberkompas deleted the 3-interpolation branch April 17, 2015 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant