Mentions légales du service

Skip to content
  • Andrei Paskevich's avatar
    Mlw: allow non-ghost expressions to return (partially) ghost values · 4c79348a
    Andrei Paskevich authored
    this is still work in progress and no testing was done so far.
    
    Highlights of this commit:
    
    - "(ghost 42, 15)" is now a non-ghost expression that can be returned
      from a function and/or matched against a "(ghost x, y)" pattern.
      Only the tuple constructor and direct pattern matching are magical:
      "let z = (ghost 42, 15) in ..." still makes z ghost, and therefore
      "snd (ghost 42, 15)" is ghost, too.
    
    - "if c then e1 else ghost e2" and "let z = e1 in ghost e2" are now
      non-ghost expressions with a ghost result. This means that e1 may
      have visible effects. Of course, if e2 raises exceptions, the whole
      expression is ghostified. Contamination is still done when possible,
      that is, when the contaminated expression has no visible effects.
    
    - "let ghost x = e1 in e2" no longer ghostifies e1.
    
    - "let f (ghost x) = ... in f e1" no longer ghostifies e1.
    
    - new syntax: variables in program patterns may be marked ghost.
      In particular: "let x, ghost y = ...".
    
    - new syntax: the function result type may be written as a partially
      ghost tuple: "val f ... : ghost int" or "any (int, ghost bool)".
      The ghostness annotation is required for top-level and recursive
      functions.
    
    - exceptions can carry partially ghost tuples (API only, WIP)
    4c79348a