SPICE-0029: Self Type - #32
Open
HT154 wants to merge 1 commit into
Open
Conversation
bioball
reviewed
Jul 15, 2026
HT154
force-pushed
the
self-type
branch
2 times, most recently
from
July 15, 2026 22:58
2a615fb to
86557c9
Compare
bioball
reviewed
Jul 31, 2026
Member
There was a problem hiding this comment.
There's a fair bit left to define about what the this type means; e.g.
- in object body param (
foo { bar: this -> }) (should be the outer enclosing object, not the inner object!) - inside object inside class body (
class Foo { obj { local bar: this = ... } }) - in let expression (
let (foo: this) ...) - in for generator (
for (foo: this in bar)) - in annotation
@this { foo = ... } - explicit new expr (
new this {})
Do you mind going through the grammar and detailing each of these scenarios?
Also: maybe we can structure this SPICE by talking about what this means in different parts of the grammar.
Then, note about resolving to the visibly outer scope can be a sub-bullet point of type test/type cast expressions I think.
| === Semantics | ||
|
|
||
| The `this` type is an alias for the class of the current receiver (`this` value). | ||
| For open classes, `this` admits values whose class is a subclass of the receiver. |
Member
There was a problem hiding this comment.
Suggested change
| For open classes, `this` admits values whose class is a subclass of the receiver. | |
| For open or abstract classes, `this` is the specific subclass of that class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.