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

Ternary operator syntax #722

Closed
emil14 opened this issue Oct 4, 2024 · 2 comments
Closed

Ternary operator syntax #722

emil14 opened this issue Oct 4, 2024 · 2 comments

Comments

@emil14
Copy link
Collaborator

emil14 commented Oct 4, 2024

See #721 this is an extension

(bool_sender ? res_sender1 : res_sender2) -> dst

Before

flow Main(start) (stop) {
    Eq, Ternary, Println
    ---
    :start -> [(2 -> eq:actual), (2 -> eq:compared)]
    eq -> ternary:if
    'They match' -> ternary:then
    'They do not match' -> ternary:else
    ternary -> println -> :stop
}

After

flow Main(start) (stop) {
    Eq, Println
    ---
    :start -> [(2 -> eq:actual), (2 -> eq:compared)]
    (eq ? 'They match' : 'They do not match') -> println -> :stop
}

With #717

flow Main(start) (stop) {
    Eq, Println
    ---
    :start -> [2 -> eq:actual, 2 -> eq:compared]
    eq -> (eq ? 'They match' : 'They do not match') -> println -> :stop
}

Plus #721

In case these chains will support trigger semantics

flow Main(start) (stop) {
    Println
    ---
    :start -> ((2 == 2) ? 'They match' : 'They do not match') -> println -> :stop
}
@emil14
Copy link
Collaborator Author

emil14 commented Oct 4, 2024

Plus #721

Instead of adding trigger semantics to () we can use deferred connections here (if they are existing)

flow Main(start) (stop) {
    Println
    ---
    :start -> |((2 == 2) ? 'They match' : 'They do not match') -> println -> :stop|
}

Noisy AF but something to think about

@emil14
Copy link
Collaborator Author

emil14 commented Oct 28, 2024

#738

@emil14 emil14 closed this as completed Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant