Skip to content

Commit

Permalink
Merge pull request #14708 from ben-albrecht/forwarding-note
Browse files Browse the repository at this point in the history
Add a note about special cases for forwarding

I found it hard to understand why IO methods did not get forwarded, so I have added some explanation in the tech note.

[Reviewed by @mppf]
  • Loading branch information
ben-albrecht authored Jan 3, 2020
2 parents 61197d8 + 125c7ad commit 4f4e862
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions doc/rst/technotes/forwarding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,25 @@ that is available. Other than that, the forwarded methods participate
normally in the function resolution process. As with other ambiguous
function declarations, ambiguity errors will be reported at the call
site.

Note that special IO methods such as ``writeThis``,
``readThis``, and ``readWriteThis`` are not forwarded since the compiler
generates these for the type by default. Similarly, a field accessor will not
get forwarded if the class defines a conflicting field or method name. Consider
the example below:

.. code-block:: chapel
record ArrayWrapper {
var array: [1..0] int;
proc shape {
return 1;
}
forwarding array;
}
The ``shape`` method above will resolve, meaning ``array.shape`` will not be
forwarded.

0 comments on commit 4f4e862

Please sign in to comment.