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

functions with body wipe context.extra #186

Closed
gdementen opened this issue Oct 14, 2015 · 0 comments
Closed

functions with body wipe context.extra #186

gdementen opened this issue Oct 14, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@gdementen
Copy link
Member

If there is in the same expression a call to a function with a body and any EvaluableExpression (which gets stored in extra, eg periodic globals, __getitem__ or attribute access), it breaks, because it first evaluates the EvalableExpression, stores it in .extra then calls the function, which wipes .extra and then by the time we try go evaluate the "larger" expression, we can't find the variable storing the EvaluableExpression result.

entities:
    test:
        processes:
            generate:
                - new('test', number=1000)

            f1(a):
                - return a + 1
            f2(a):
                - r: a + 1
                - return r

            test_issue:
                # works
                - y: id[0]
                - z: y + f2(1)
                - z: id[0] + f1(1)
                # fails
                - z: id[0] + f2(1)

simulation:
    processes:
        - test: [generate, test_issue]
    input:
        method: void
        file: none
    output:
        file: output.h5
    start_period: 2015
    periods: 1
@gdementen gdementen added the bug label Oct 14, 2015
@gdementen gdementen self-assigned this Oct 14, 2015
gdementen added a commit that referenced this issue Jan 25, 2018
…thing except + - * / and where) and a function call failing to evaluate
@gdementen gdementen added this to the 0.12 milestone Jan 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant