27 This

The path tail this refers to the current value in the path. It is useful when the current value itself is needed, rather than one of its attributes.

For example, the following expression outputs each session together with the code of the course it belongs to:


u.course.session.(course.code as courseCode, this)

Inside session.(...), the current value is a session, so this outputs that session. The path tail this does not navigate anywhere; it uses the value already reached at that point in the path.

A path is read from left to right, and this means the current value at the point where it is written.

The output can give an explicit name to this. This expression reaches the advanced courses and outputs the course value itself, together with some of its attributes:


u.course.[advanced].(this as advancedCourse, code, title)

Inside [advanced].(...), the current value is still a course. The output named advancedCourse is therefore the reached course value, while code and title are attributes of the same course.

The same pattern is useful when a path has reached a value but the result should also show where it came from:


u.course.session.(this as scheduledSession, room, course)

Here this is the session reached by u.course.session, exposed under the result name scheduledSession. The course attribute is the course attached to that session.