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

Added `sec[bool]` and `sec[f64]` #375

Merged
merged 4 commits into from Sep 14, 2016

Conversation

@bvssvni
Copy link
Member

commented Sep 12, 2016

Closes #367, fixes a bug in the lifetime checker #374

This PR adds sec[bool] and sec[f64] types, which improves type safety for secrets and makes it easier to generate efficient Rust code from Dyon in the future.

What is a secret?

A secret is a "hidden" array that is associated with a bool or f64. It is used to make problem solving easier by integrating this with mathematical loops in Dyon.

For example, to look up where a maximum value comes from:

fn main() {
    list := [[1, 2], [3, 4]]
    item := 0
    max := max i, j {
        item = list[i][j]
        if item == 4 { continue }
        item
    }
    println(max) // prints `4`
    println(where(max)) // prints `[1, 0]`
}

Dyon uses index notation for mathematical loops, such that the argument of any/all/min/max compositions of loops can be propagated as a secret.

bvssvni added some commits Sep 12, 2016

Fixed bug in lifetime checker
Closes #374

- Added “syntax/lifetime_17.dyon”
Infer secret on compare operations
- Added “secret_9.dyon”
- Added “secret_10.dyon”

@bvssvni bvssvni merged commit 2dcfb2e into PistonDevelopers:master Sep 14, 2016

@bvssvni bvssvni deleted the bvssvni:sec branch Sep 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.