Is `this.type` a path-dependent type? What makes it special?

Original article:

Looks like some details were hidden in the publications that even the most proficient users feel ambiguous.

In section 7.7 of the definitive article:

I found the following deduction:

“As the final step, we unify the separate constructs for recursion,
records, and lambda abstractions, into a single notion of object.”

I wonder if this exception is caused by such lossy merging of concepts, should this rule be explicitly defined or even generalised?

I have no idea what you are talking about. Section 7.7 of what? Do you have a specific question to ask?

Just added the publication that contains section 7.7.

Sorry I just realised that DOT has several seminal publications. Hope it is clear now

I don’t know about DOT, but in the Scala type system, this.type is the target of the fundamental “as seen from” meta operation on types :

For a Scala 3 equivalent, I happened to open today a PR to update that section of the spec to Scala 3, which is already quite a bit closer to DOT:

1 Like

In DOT, this is just an identifier bound when we create a record. So, this.T is a path dependent type, for any member type T. But DOT does not have singleton types. So this.type is not handled. It would be interesting to see an extension of DOT along these lines.

1 Like

This post was flagged by the community and is temporarily hidden.