Skip to content

Capture referenced bindings in anonymous functions #50

@fuelen

Description

@fuelen

Describe the bug
Spark doesn't capture referenced bindings in generated functions.

To Reproduce

        presets do
          for {name, message} <- [{:bend, "stuff"}, {:start_casino, "with fun stuff"}] do
            preset name do
              default_message(message)

              contacter(fn message1 ->
                "#{message1}: #{unquote(message)}"
              end)
            end
          end
        end

error:

** (CompileError) test/dsl_test.exs:74: undefined function message/0 (there is no such import)

Expected behavior
Presence of referenced bindings in anonymous functions should generate different anonymous functions depending on the actual value of the binding.

Runtime

  • Spark version: latest

Additional context
Link to conversation in Discord.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions