Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Add final attribute #339

Merged
merged 6 commits into from
Dec 14, 2022
Merged

Add final attribute #339

merged 6 commits into from
Dec 14, 2022

Conversation

rossberg
Copy link
Member

@rossberg rossberg commented Nov 15, 2022

This adds a spec of the final attribute for experimentation:

  • In the abstract syntax, it is possible to write sub $t* ... or sub final $t* ....
  • In the binary format, sub final is encoded as -0x32, with the same format as sub.
  • When validating a sub definition, none of the supertypes may be final.
  • The non-sub shorthands (and therefor existing function types) are reinterpreted to final.

Due to the latter, a subtypable struct or array must now be written explicitly, with an empty list of supertypes:

(type (struct))  ;; final, no supertypes (shorthand)
(type (sub final (struct)))  ;; same in expanded form
(type (sub (struct)))  ;; non-final, no supertypes
(type (sub $t (struct)))  ;; non-final, with supertype
(type (sub final $t (struct)))  ;; final, with supertype

@rossberg
Copy link
Member Author

Added interpreter implementation and test suite changes & extensions.

@rossberg rossberg changed the title [experiment] Specify final attribute Add final attribute Dec 14, 2022
@rossberg
Copy link
Member Author

Taking the liberty to land this, since I will already be out tomorrow, for 3 weeks.

@rossberg rossberg merged commit 33d8b36 into main Dec 14, 2022
@rossberg rossberg deleted the final branch December 14, 2022 08:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant