1. 08 Jun, 2017 16 commits
  2. 07 Jun, 2017 4 commits
  3. 06 Jun, 2017 13 commits
  4. 05 Jun, 2017 4 commits
    • Andrei Paskevich's avatar
      Mlw: labels can act as local exceptions · cda6d915
      Andrei Paskevich authored
      Useful to break out of the loops:
      
        label Break in
        while ... do
          label Continue in
          ... raise Break ...
          ... raise Continue ...
        done
      
      When a label is put over a non-unit expression,
      raise acts as return:
      
        label Return in
        if ... then raise Return 42; 0
      
      Also, "return <expr>" returns from the innermost function.
      This includes abstract blocks, too, so if you want to return
      across an abstract block, you should rather use a label at
      the top of the main function. TODO/FIXME: maybe we should
      let "return" pass across abstract blocks by default, to
      avoid surprises?
      
      One shortcoming of the labels-as-exceptions is that they cannot
      be used to transmit tuples with ghost elements, nor return ghost
      values from non-ghost expressions. A local exception with an
      explicit mask should be used instead. Similarly, to return
      a partially ghost value from a function, it must have have
      its mask explicitly written (which is a good practice anyway).
      We cannot know the mask of an expr before we construct it,
      but in order to construct it, we need to create the local
      exceptions first.
      
      Another caveat is that while it is possible to catch an exception
      generated by a label, you should avoid to do so. We only declare
      the local exception if the expression under the label _raises_
      the exception, and thus the following code will not typecheck:
      
        label X in (try raise X with X -> () end)
      
      Indeed, the expression in the parentheses does not raise X,
      and so we do not declare a local exception X for this label,
      and so the program contains an undeclared exception symbol.
      cda6d915
    • Andrei Paskevich's avatar
      Mlw: local exceptions in the surface language · b3a73a61
      Andrei Paskevich authored
      current syntax is
      
          exception Return (int, ghost bool) in
          ...
          try
            ...
            raise Return (5, false)
            ...
          with
            Return (i, b) -> ...
          ...
      
      These exceptions can carry mutable and non-monomorphic values.
      They can be raised from local functions defined in the scope
      of the exception declaration.
      b3a73a61
    • Andrei Paskevich's avatar
      Mlw: API for local exceptions · 53b3ec88
      Andrei Paskevich authored
      53b3ec88
    • Andrei Paskevich's avatar
      Ity: handle local exceptions · 9720661b
      Andrei Paskevich authored
      Since local exceptions can carry results with type variables
      and regions, we need to freeze them in the function signatures.
      9720661b
  5. 04 Jun, 2017 3 commits
    • Andrei Paskevich's avatar
      cosmetic · 77811564
      Andrei Paskevich authored
      77811564
    • Andrei Paskevich's avatar
      minor changes in examples · 12379417
      Andrei Paskevich authored
      avoid using logical symbols in programs in a few places
      12379417
    • Andrei Paskevich's avatar
      bench: typecheck the gallery before extraction/execution · 85074baf
      Andrei Paskevich authored
      I know that extraction and execution are much more fun than
      the boring "can we even parse WhyML at all?" question, but
      you see, if our parsing/typechecking is broken, then the fun
      stuff is broken, too. And I really prefer to get the error
      messages about the typechecking being broken from the typechecking
      part of the bench, and not from the test-api or extraction part.
      Merci pour votre compréhension.
      85074baf