Giter VIP home page Giter VIP logo

Comments (8)

denismerigoux avatar denismerigoux commented on June 1, 2024 1

Yep the above should work fine :)

from hacspec.

denismerigoux avatar denismerigoux commented on June 1, 2024

I prefer to allow inline if then else expressions, it's not much work for me. However, I cannot allow let declarations without initialization because their semantics cannot be easily mapped to a regular functional language semantic.

from hacspec.

franziskuskiefer avatar franziskuskiefer commented on June 1, 2024

That works too. People might be more used to let bindings without, but not in Rust. So we should allow the following

let x = if y > 5 {
    1
} else {
    2
};

from hacspec.

franziskuskiefer avatar franziskuskiefer commented on June 1, 2024

@denismerigoux this doesn't appear to work.

error[Hacspec]: let binding expression should not contain statements in Hacspec
   --> /Users/franziskus/repos/hacspec/examples/p256/src/p256.rs:71:18
    |
71  |       let result = if is_point_at_infinity(p) {

from hacspec.

denismerigoux avatar denismerigoux commented on June 1, 2024

What is the code after ? Because the error message seems correct ot me : "let binding expression should not contain statements in Hacspec"

from hacspec.

franziskuskiefer avatar franziskuskiefer commented on June 1, 2024

I'm trying to get the p256 code into hacspec

let result = if is_point_at_infinity(p) {
(true, q)
// } else if is_point_at_infinity(q) {
// (true, p)
} else {

from hacspec.

denismerigoux avatar denismerigoux commented on June 1, 2024

What is in the else branch? Something forbidden in Hacspec would be

let result = if is_point_at_infinity(p) { 
     (true, q) 
 else { foo = x; (false, q)}

from hacspec.

denismerigoux avatar denismerigoux commented on June 1, 2024

Inline conditionals (inside let statements) cannot have side-effects (like variable assignment) right now in Hacspec. Otherwise the compilation scheme to something like F* becomes much more complicated.

from hacspec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.