Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/components/delegate-members.x

Delegate fields.

Design notes

A field declared delegate T name; answers the method calls its aggregate lacks. The parser marks each such field, and the rule below is registered for the mark, so only a call that finds no member on a receiver whose aggregate declares one tests it. The rule searches the receiver’s delegate fields depth first in field order and rebuilds the call through the one path that finds the method. More than one path, or a cycle with no path, is an error.

Each definition precedes the definitions that call it: the compiler settles whether a linked copy reaches a compile-time operation when the copy binds.