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

Simplifying control flow operators #2

Open
gancherj opened this issue Mar 29, 2023 · 0 comments
Open

Simplifying control flow operators #2

gancherj opened this issue Mar 29, 2023 · 0 comments

Comments

@gancherj
Copy link
Collaborator

Currently, we have code like:

    if eq(length(M), |nonce|) then
        if eq(length(A), |nonce|) then
            if eq(length(B), |nonce|) then
                case x1 
                | mA2_enc _ => ()
                | mA1_enc x1' => 
                    (case dec(kA, x1')
                        | None => ()
                        | Some resA =>
                            unpack j1, resA' = resA in
                            unpack j2, resA'' = resA' in
                            (case resA''
                                | mA1 msg1A => ...
                                | mA2 _ => ...))

Aside from the nested equality checks, we also want better syntax for nested case expressions, and nested unpacks.
Perhaps something like:

(mA1_enc x1') =? x1 in 
(Some ResA) =? dec(kA, x1') in
...

where the semantics of =? is to return () if the pattern match fails. (Or, perhaps if we return an option, to return None).
A Rust-style if let operation would work well too.

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

1 participant