blob: feee5d1405674c68ae682b195aea62686ce91a21 [file] [log] [blame]
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "../xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../css/ot.css" />
<link rel="stylesheet" type="text/css" href="../css/otjld.css" />
<title>OT/J Language Definition v1.3.1</title>
</head>
<body class="otdt">
<div id="content">
<table class="nav">
<tr>
<td class="back"><a id="top"></a><a href="s4.3.html" rel="prev">&lt;&lt;&nbsp;&sect;4.3&nbsp;Base calls</a></td>
<td class="top"><a href="index.html" rel="contents">&uarr;&nbsp;Table of Contents&nbsp;&uarr;</a></td>
<td class="next"><a href="s4.5.html" rel="next">&sect;4.5&nbsp;Lifting and lowering&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s4.html" rel="section">&sect;4&nbsp;Callin Binding</a></div>
<div class="sect depth2" id="s4.4">
<h2 class="sect">&sect;4.4&nbsp;Callin parameter mapping<a class="img" href="s4.4.html"
title="PermaLink to &sect;4.4&nbsp;Callin parameter mapping"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h2>
<div class="subsect depth3" id="s4.4.a">
<h4 class="subsect">(a)&nbsp;<span class="title">General case parameter mapping</span><a class="img" href="s4.4.a.html"
title="PermaLink to (a)&nbsp;General case parameter mapping"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>The rules for mapping callin parameters and result type
are mainly the same as for callout bindings (<a href="s3.2.html" title="&sect;3.2&nbsp;Callout parameter mapping"
class="sect">&sect;3.2</a>)
except for reversing the <code>-&gt;</code> and <code>&lt;-</code> tokens and
swapping left hand side and right hand side.
<br />
Callin bindings using <code>before</code> have no result mapping.
For <code>result</code> in <code>after</code> callin bindings
see <a href="#s4.4.c"
title="&sect;4.4.(c)&nbsp;Mapping the result of a base method"
class="sect">&sect;4.4.(c)</a> below.
</p>
</div>
<div class="subsect depth3" id="s4.4.b">
<h4 class="subsect">(b)&nbsp;<span class="title">Restrictions for callin replace bindings</span><a class="img" href="s4.4.b.html"
title="PermaLink to (b)&nbsp;Restrictions for callin replace bindings"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>The right-hand side of a parameter mapping may either be
the simple name of a base method argument without further computation,
or an arbitrary expression <em>not</em> containing any base method argument.
<br />
Each base method argument must either appear as a simple name in exactly one parameter mapping
or not be mapped at all. In the latter case, the original argument is "tunneled" to
the base call, meaning, the callin method does not see the argument, but it is passed
to the base method as expected.
<br />
If the base method declares a result, then
</p>
<ul>
<li>if the role method also declares a result, <code>result</code> must be mapped to itself:
<br /><code>result -&gt; result</code></li>
<li>if the role method does not declare a result, an arbitrary expression may be mapped to result:
<br /><code><em>expression</em> -&gt; result</code><br />
If in this situation no result mapping exists, the result of the base call
is "tunneled" and passed to the original caller (see <a href="s4.3.e.html" title="&sect;4.3.(e)&nbsp;Fragile callin binding"
class="sect">
fragile callin binding (&sect;4.3.(e))</a> above).
</li>
</ul>
<p>These rules ensure that these bindings are reversible
for the sake of base calls (<a href="s4.3.html" title="&sect;4.3&nbsp;Base calls" class="sect">&sect;4.3</a>).
</p>
<p>As stated above a fragile callin binding (<a href="s4.3.e.html" title="&sect;4.3.(e)&nbsp;Fragile callin binding"
class="sect">&sect;4.3.(e)</a>)
is not allowed with a callin method that definitely has no base call
(<a href="s4.3.b.html" title="&sect;4.3.(b)&nbsp;Missing base call"
class="sect">&sect;4.3.(b)</a>). A callin replace binding is not fragile if it provides
the base result using a result mapping.
</p>
<p>A callin method bound with replace to a base method returning
void must not declare a non-void result.
</p>
</div>
<div class="subsect depth3" id="s4.4.c">
<h4 class="subsect">(c)&nbsp;<span class="title">Mapping the result of a base method</span><a class="img" href="s4.4.c.html"
title="PermaLink to (c)&nbsp;Mapping the result of a base method"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>In an <code>after</code> callin binding, the right-hand side
of a parameter mapping may use the identifier <code>result</code>
to refer to the result of the base method.
</p>
<p>
An <code>after</code> callin binding
can, however, not <em>influence</em> the result of the base method,
thus mappings with the <code>-&gt;</code> token are not allowed for after callin bindings.
For <code>before</code> mappings using the <code>-&gt;</code> token is already ruled out by <a href="#s4.4.a" title="&sect;4.4.(a)&nbsp;General case parameter mapping"
class="sect">&sect;4.4.(a)</a></p>
</div>
<div class="subsect depth3" id="s4.4.d">
<h4 class="subsect">(d)&nbsp;<span class="title">Multiple base methods</span><a class="img" href="s4.4.d.html"
title="PermaLink to (d)&nbsp;Multiple base methods"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>A callin binding listing more than one base method may use parameter
mappings with only the following restriction: if any base parameter should be mapped this parameter
must have the same name and type in all listed base method designators.
However, different parameter mappings for different base methods bound to the same role method
can be defined if separate callin bindings are used.
</p>
</div>
</div>
<table class="nav">
<tr>
<td class="back"><a href="s4.3.html" rel="prev">&lt;&lt;&nbsp;&sect;4.3&nbsp;Base calls</a></td>
<td class="top"><a href="index.html" rel="contents">&uarr;&nbsp;Table of Contents&nbsp;&uarr;</a></td>
<td class="next"><a href="s4.5.html" rel="next">&sect;4.5&nbsp;Lifting and lowering&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s4.html" rel="section">&sect;4&nbsp;Callin Binding</a></div>
</div>
<div id="footer">
<hr /><a class="w3c img" href="http://jigsaw.w3.org/css-validator/check/referer"
shape="rect"><img src="../images/valid-css2-blue.png" alt="Valid CSS!" height="31" width="88" /></a><a class="w3c img" href="http://validator.w3.org/check?uri=referer" shape="rect"><img src="../images/valid-xhtml10-blue.png" alt="Valid XHTML 1.0 Strict" height="31"
width="88" /></a><address>&copy; Stephan Herrmann, Christine Hundt, Marco Mosconi</address>
OT/J version 1.3.1 &mdash; last modified: 2013-05-28
</div>
</body>
</html>