blob: 620f57e7804147c2a748a728d7701a7946b289b4 [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</title>
</head>
<body class="otdt">
<div id="content">
<table class="nav">
<tr>
<td class="back"><a id="top"></a><a href="s1.2.2.a.html" rel="prev">&lt;&lt;&nbsp;&sect;1.2.2.(a)&nbsp;Visibility</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="s1.2.2.c.html" rel="next">&sect;1.2.2.(c)&nbsp;Immutable anchor&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s1.html" rel="section">&sect;1&nbsp;Teams and Roles</a>&nbsp;&gt;&nbsp;<a class="nav" href="s1.2.html" rel="section">&sect;1.2&nbsp;Role classes and objects</a>&nbsp;&gt;&nbsp;<a class="nav" href="s1.2.2.html" rel="section">&sect;1.2.2&nbsp;Externalized roles</a></div>
<div class="subsect depth4" id="s1.2.2.b">
<h4 class="subsect">&sect;1.2.2.(b)&nbsp;<span class="title">Declaration with anchored type</span><a class="img" href="s1.2.2.b.html"
title="PermaLink to (b)&nbsp;Declaration with anchored type"><img style="vertical-align:text-top;margin-left:5px;" src="../images/permalink.png"
alt="" /></a></h4>
<p>Outside a team role types are legal only if denoted relative
to an existing team instance (further on called "anchored types").
The syntax is:
</p>
<div class="listing plain"><pre><em>final</em> MyTeam myTeam = <i>expression</i>;
<em>RoleClass&lt;@myTeam&gt;</em> role = <i>expression</i>;</pre></div>
<p>The syntax <code>Type&lt;@anchor&gt;</code> is a special case of a parameterized type, more specifically a <a href="s9.html" title="&sect;9&nbsp;Value Dependent Classes" class="sect">value dependent type (&sect;9)</a>.
The type argument (i.e., the expression after the at-sign) can be a simple name or a path. It must refer to an instance
of a team class.
The role type is said to be <em>anchored</em> to this team instance.<br />
The type-part of this syntax (in front of the angle brackets) must be the simple name of a role type directly contained
in the given team (including roles that are acquired by implicit inheritance).<br /></p>
<div class="note">
<h5>Note:</h5>
Previous versions of the OTJLD used a different syntax for anchored types, where the role type was prefixed with the anchor
expression, separated by a dot (<code>anchor.Type</code>,
see <a href="sA.html#sA.6.3" title="&sect;A.6.3&nbsp;AnchoredType" class="sect">&sect;A.6.3</a>). A compiler may still support that path syntax but it should be flagged as being deprecated.
</div>
</div>
<table class="nav">
<tr>
<td class="back"><a href="s1.2.2.a.html" rel="prev">&lt;&lt;&nbsp;&sect;1.2.2.(a)&nbsp;Visibility</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="s1.2.2.c.html" rel="next">&sect;1.2.2.(c)&nbsp;Immutable anchor&nbsp;&gt;&gt;</a></td>
</tr>
</table>
<div class="breadcrumb"><a class="nav" href="s1.html" rel="section">&sect;1&nbsp;Teams and Roles</a>&nbsp;&gt;&nbsp;<a class="nav" href="s1.2.html" rel="section">&sect;1.2&nbsp;Role classes and objects</a>&nbsp;&gt;&nbsp;<a class="nav" href="s1.2.2.html" rel="section">&sect;1.2.2&nbsp;Externalized roles</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 &mdash; last modified: 2011-05-15
</div>
</body>
</html>