Skip to content

Failure when defining a function with no args #53

@JockLawrie

Description

@JockLawrie

Hi there,

I have users defining (simple) functions as strings in a config file, which ultimately get made into functions.
Often a user has a function return a constant.
My code fails in this case, MWE below.
Any ideas where I'm going wrong?

using RuntimeGeneratedFunctions
RuntimeGeneratedFunctions.init(@__MODULE__)

s = "() -> 1"
ex = Meta.parse(s)
f = @RuntimeGeneratedFunction(ex)

If I set s = (x) -> 1 it works, but then I don't have a function of 0 arguments, which is required by downstream code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions