Use `open` instead of `final` in the text format
Addresses discussion from #333. With this patch, the keyword final in subtypes has been replaced with the keyword open:
(type $s1 (sub (struct))) ;; final with no super types
(type $s2 (sub open (struct))) ;; non-final with no super types
(type $s3 (sub $s2 (struct (field i32)))) ;; final with one super type
(type $s4 (sub open $s2 (struct (field i32)))) ;; non-final with one super type
(type $s5 (struct)) ;; equivalent to $s1 (final)
This avoids a confusing flip-flopping behavior where a seemingly-unnecessary empty sub was commonly used to make types non-final. An empty sub is now equivalent to no sub, making the abbreviation more obvious.
This patch is currently quite minimal, and only modifies enough of the spec and interpreter to support open in the text format. The word final is otherwise used throughout the spec and interpreter. If we would rather use the word open everywhere, I'd be happy to update the rest of the spec and interpreter to match.
I would support having both sub open and sub final. That seems strictly clearer, although slightly more verbose. It's also useful to still have the "final" language for non-open types.
@bvisness, will you have time to work on this more today and Monday? If not, I can help out.
@rossberg, would it suffice to add sub open just to the text format and keep final? in the abstract syntax, or would you want to change the abstract syntax to have final | open as well?
I think we should keep them consistent. It actually simplifies some formulations as well when we have a named phrase like ext ::= FINAL | OPEN, because then ext can be used as a metavariable instead of clumsy FINAL?.
@rossberg, would you be able to work on completing this change? If not, I will take a stab at it in the morning pacific time.
@tlively, I can try, but I can't promise anything — I'm on an a flight Odyssee right now after I was dumped from my flight back to Europe yesterday. Hence my bigger concern is that I even make it back in time for the meeting tomorrow. ;)
Apologies for my absence. I can resume work on this tomorrow if it's not already done.