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

Should capture lists on imperative blocks be optional? #33

Open
pboyer opened this issue Oct 31, 2016 · 1 comment
Open

Should capture lists on imperative blocks be optional? #33

pboyer opened this issue Oct 31, 2016 · 1 comment

Comments

@pboyer
Copy link
Contributor

pboyer commented Oct 31, 2016

No description provided.

@ke-yu
Copy link
Contributor

ke-yu commented Nov 15, 2016

My initial thought was, imperative block could be removed - code in {} in imperative control flow would be in non-imperative context (let's not use associative anymore), but realise that besides sequential execution in imperative code, multi assignment is OK in imperative context, e.g.,

[Imperative]
{
    x = 0;
    cond = ...
    while (x < 100) {
        if (cond)
            x = x + 1;
        else
            x = x + 2;
    }
}

So if capture list is optional, we have to check (in usage and in compiler implementation) a variable is defined in this imperative block scope or not. If it is defined outside, it shouldn't be modified. To me it is inconvenient.

x = 1;
[Imperative]
{
    y = 2;
    x = 2;   // Invalid
    y = 3;   // OK
}

If capture list is not optional, it is clear that the value is "copied" to the imperative block:

x = 1;
[Imperative](x)
{
     while (x < 100) {
        x = x + 1;  // OK to assign new value to "x"
    }
}
// here x is still 1

The other benefit is to support replication on imperative language block.

The downside is some current workflows will be broken. To mitigate that, if there is an error in code block node, we won't delete all connectors until error gets fixed.

@pboyer what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants