• Andrei Paskevich's avatar
    WhyML: tuple terms/expressions do not require parentheses · a1e032f6
    Andrei Paskevich authored
    This makes the syntax cleaner and brings us closer to OCaml.
    
    One incompatibility with the previous grammar is that "ghost"
    binds stronger than the left arrow of assignment, and thus
    ghost assignments have to be written as "ghost (x.f <- v)".
    
    This is unavoidable, because assignment has to be weaker than
    the tuple comma (think "x.f, y.g <- y.g, x.f" or "a[i] <- u,v"),
    and "ghost" has to be stronger than comma, for consistency with
    our patterns and our return types.
    
    The "return" construction is weaker than comma, for "return a,b".
    It is also weaker than assignment, though "return x.f <- b" does
    not make much sense either way.
    
    This change does not concern type expressions, where a tuple
    type must always have its clothes^Wparentheses on: (int, int).
    It might be nice to write "constant pair: int, bool", but on
    the other hand this would break casts like "42: int, true".
    a1e032f6
mergesort_list.mlw 9.29 KB