Date: Thu, 28 Mar 2024 16:06:28 +0100 (CET) Message-ID: <1938065916.506.1711638388211@nm-docs> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_505_1810257728.1711638388210" ------=_Part_505_1810257728.1711638388210 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Like Java and JavaScript, Alf uses the keyword this to denote t= he current instance of the context Class in which the this express= ion occurs. Unlike Java and JavaScript, however, the Alf specification requ= ires that this be used explicitly in order to access features (Pro= perties, Operations and Receptions) of the context Class. For example, = this is used extensively in the activity diagram shown below to access= context Properties and to invoke the getCurrentTemp Operation.
The Alf Plugin implements an extension to the Alf language that allows c= ontext features to be accessed by name without explicitly using a this<= /em> prefix. This is similar to what is allowed in Java and JavaScript. For= example, the meaning of the Alf code in the above example remains the same= if al the this expressions are dropped, as shown below.
Unlike Java and JavaScript, Alf allows new local names to be defined wit= hout an explicit declaration. This can result in the masking of errors if t= he name of a context attribute is misspelled on the left-hand side of an as= signment statement. For instance, if the assignment in the action on the lo= wer left in the activity above were changed to Fcntrol =3D Fmin; (= with "Fcontrol" misspelled to "Fcntrl"), this would n= ot be reported as an error. Rather, the assignment would simply define= a new local name Fcntrl within the Opaque Action, which would be = assigned Fmin as its initial value, with no effect on Fcontrol= .