summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-11-07 18:40:57 +0000
committerAlasdair Armstrong2018-11-07 18:40:57 +0000
commit61e6bc97a7d5efb58f9b91738f1dd64404091137 (patch)
treebcc66d5ab779fbce7fac6ec8ac40569244cda7f1 /editors
parent18c49a76854408d7c2cea74eeb07fd312a5927aa (diff)
Move inline forall in function definitions
* Previously we allowed the following bizarre syntax for a forall quantifier on a function: val foo(arg1: int('n), arg2: typ2) -> forall 'n, 'n >= 0. unit this commit changes this to the more sane: val foo forall 'n, 'n >= 2. (arg1: int('n), arg2: typ2) -> unit Having talked about it today, we could consider adding the syntax val foo where 'n >= 2. (arg1: int('n), arg2: typ2) -> unit which would avoid the forall (by implicitly quantifying variables in the constraint), and be slightly more friendly especially for documentation purposes. Only RISC-V used this syntax, so all uses of it there have been switched to the new style. * Second, there is a new (somewhat experimental) syntax for existentials, that is hopefully more readable and closer to minisail: val foo(x: int, y: int) -> int('m) with 'm >= 2 "type('n) with constraint" is equivalent to minisail: {'n: type | constraint} the type variables in typ are implicitly quantified, so this is equivalent to {'n, constraint. typ('n)} In order to make this syntax non-ambiguous we have to use == in constraints rather than =, but this is a good thing anyway because the previous situation where = was type level equality and == term level equality was confusing. Now all the type type-level and term-level operators can be consistent. However, to avoid breaking anything = is still allowed in non-with constraints, and produces a deprecated warning when parsed.
Diffstat (limited to 'editors')
-rw-r--r--editors/sail2-mode.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/editors/sail2-mode.el b/editors/sail2-mode.el
index de8c3d11..ac3c199c 100644
--- a/editors/sail2-mode.el
+++ b/editors/sail2-mode.el
@@ -9,7 +9,7 @@
"overload" "cast" "sizeof" "constraint" "default" "assert" "newtype" "from"
"pure" "infixl" "infixr" "infix" "scattered" "end" "try" "catch" "and" "to"
"throw" "clause" "as" "repeat" "until" "while" "do" "foreach" "bitfield"
- "mapping" "where"))
+ "mapping" "where" "with"))
(defconst sail2-kinds
'("Int" "Type" "Order" "inc" "dec"