summaryrefslogtreecommitdiff
path: root/support/arara/doc/chapters/mvel.tex
diff options
context:
space:
mode:
Diffstat (limited to 'support/arara/doc/chapters/mvel.tex')
-rw-r--r--support/arara/doc/chapters/mvel.tex36
1 files changed, 18 insertions, 18 deletions
diff --git a/support/arara/doc/chapters/mvel.tex b/support/arara/doc/chapters/mvel.tex
index 7dd9564576..4ccca9b814 100644
--- a/support/arara/doc/chapters/mvel.tex
+++ b/support/arara/doc/chapters/mvel.tex
@@ -2,7 +2,7 @@
\chapter{MVEL}
\label{chap:mvel}
-According to the \href{https://en.wikipedia.org/wiki/MVEL}{Wikipedia entry}, the MVFLEX Expression Language (hereafter referred as \gls{MVEL}) is a hybrid, dynamic, statically typed, embeddable expression language and runtime for the Java platform. Originally started as a utility language for an application framework, the project is now developed completely independently. \arara\ relies on this scripting language in two circumstances:
+According to the \href{https://en.wikipedia.org/wiki/MVEL}{Wikipedia entry}, the MVFLEX Expression Language (hereafter referred as MVEL) is a hybrid, dynamic, statically typed, embeddable expression language and runtime for the Java platform. Originally started as a utility language for an application framework, the project is now developed completely independently. \arara\ relies on this scripting language in two circumstances:
\begin{enumerate}
\item\emph{Rules}, as nominal attributes gathered from directives are used to build complex command invocations and additional computations. A rule follows a very strict model, detailed in Section~\ref{sec:rule}, on page~\pageref{sec:rule}.
@@ -10,7 +10,7 @@ According to the \href{https://en.wikipedia.org/wiki/MVEL}{Wikipedia entry}, the
\item\emph{Conditionals}, as logical expressions must be evaluated in order to decide whether and how a directive should be interpreted. Conditionals are detailed in Section~\ref{sec:directives}, on page~\pageref{sec:directives}.
\end{enumerate}
-This chapter only covers the relevant parts of the \gls{MVEL} language for a consistent use with \arara. For advanced topics, I highly recommend the official language guide for \gls{MVEL} 2.0, available online.
+This chapter only covers the relevant parts of the MVEL language for a consistent use with \arara. For advanced topics, I highly recommend the official language guide for MVEL 2.0, available online.
\section{Basic usage}
\label{sec:mvelbasicusage}
@@ -27,7 +27,7 @@ In this expression, we have a single identifier \rbox{user.name}, which by itsel
user.name == 'John Doe'
\end{codebox}
-This expression yields a boolean result, either \rbox{true} or \rbox{false} based on a comparison operation. Like a typical programming language, \gls{MVEL} supports the full gamut of operator precedence rules, including the ability to use bracketing to control execution order:
+This expression yields a boolean result, either \rbox{true} or \rbox{false} based on a comparison operation. Like a typical programming language, MVEL supports the full gamut of operator precedence rules, including the ability to use bracketing to control execution order:
\begin{codebox}{Execution order control through bracketing}{teal}{\icnote}{white}
(user.name == 'John Doe') && ((x * 2) - 1) > 20
@@ -39,7 +39,7 @@ You may write scripts with an arbitrary number of statements using a semicolon t
statement1; statement2; statement3
\end{codebox}
-It is important to observe that \gls{MVEL} expressions use a \emph{last value out} principle. This means, that although \gls{MVEL} supports the \rbox{return} keyword, it can be safely omitted. For example:
+It is important to observe that MVEL expressions use a \emph{last value out} principle. This means, that although MVEL supports the \rbox{return} keyword, it can be safely omitted. For example:
\begin{codebox}{Automatic return}{teal}{\icnote}{white}
foo = 10;
@@ -57,18 +57,18 @@ return foo;
Personally, I like to explicitly add a \rbox{return} statement, as it provides a visual indication of the expression exit point. All rules released with \arara\ favour this writing style. However, feel free to choose any writing style you want, as long as the resulting code is consistent.
-The type coercion system of \gls{MVEL} is applied in cases where two incomparable types are presented by attempting to coerce the right value to that of the type of the left value, and then vice-versa. For example:
+The type coercion system of MVEL is applied in cases where two incomparable types are presented by attempting to coerce the right value to that of the type of the left value, and then vice-versa. For example:
\begin{codebox}{Type coercion}{teal}{\icnote}{white}
"123" == 123;
\end{codebox}
-Surprisingly, the evaluation of such expression holds \rbox{true} in \gls{MVEL} because the underlying type coercion system will coerce the untyped number \rbox{123} to a string \rbox{123} in order to perform the comparison.
+Surprisingly, the evaluation of such expression holds \rbox{true} in MVEL because the underlying type coercion system will coerce the untyped number \rbox{123} to a string \rbox{123} in order to perform the comparison.
\section{Inline lists, maps and arrays}
\label{sec:mvelinlinelistsmapsandarrays}
-According to the documentation, \gls{MVEL} allows you to express lists, maps and arrays using simple elegant syntax. Lists are expressed in the following format:
+According to the documentation, MVEL allows you to express lists, maps and arrays using simple elegant syntax. Lists are expressed in the following format:
\begin{codebox}{Creating a list}{teal}{\icnote}{white}
[ "Jim", "Bob", "Smith" ]
@@ -97,7 +97,7 @@ In this case, the scripting language will see that the target method accepts an
\section{Property navigation}
\label{sec:propertynavigation}
-\gls{MVEL} provides a single, unified syntax for accessing properties, static fields, maps and other structures. Lists are accessed the same as arrays. For example, these two constructs are equivalent (\gls{MVEL} and Java access styles for lists and arrays, respectively):
+MVEL provides a single, unified syntax for accessing properties, static fields, maps and other structures. Lists are accessed the same as arrays. For example, these two constructs are equivalent (MVEL and Java access styles for lists and arrays, respectively):
\begin{codebox}{MVEL access style for lists and arrays}{teal}{\icnote}{white}
user[5]
@@ -107,7 +107,7 @@ user[5]
user.get(5)
\end{codebox}
-Observe that \gls{MVEL} accepts plain Java methods as well. Maps are accessed in the same way as arrays except any object can be passed as the index value. For example, these two constructs are equivalent (\gls{MVEL} and Java access styles for maps, respectively):
+Observe that MVEL accepts plain Java methods as well. Maps are accessed in the same way as arrays except any object can be passed as the index value. For example, these two constructs are equivalent (MVEL and Java access styles for maps, respectively):
\begin{codebox}{MVEL access style for maps}{teal}{\icnote}{white}
user["foobar"]
@@ -123,7 +123,7 @@ It is advisable to favour such access styles over their Java counterparts when w
\section{Flow control}
\label{sec:mvelflowcontrol}
-The expression language goes beyond simple evaluations. In fact, \gls{MVEL} supports an assortment of control flow operators (namely, conditionals and repetitions) which allows advanced scripting operations. Consider this conditional statement:
+The expression language goes beyond simple evaluations. In fact, MVEL supports an assortment of control flow operators (namely, conditionals and repetitions) which allows advanced scripting operations. Consider this conditional statement:
\begin{codebox}{Conditional statement}{teal}{\icnote}{white}
if (var > 0) {
@@ -137,7 +137,7 @@ else {
}
\end{codebox}
-As seen in the previous code, the syntax is very similar to the ones found in typical programming languages. \gls{MVEL} also provides a shorter version, known as a ternary statement:
+As seen in the previous code, the syntax is very similar to the ones found in typical programming languages. MVEL also provides a shorter version, known as a ternary statement:
\begin{codebox}{Ternary statement}{teal}{\icnote}{white}
answer == true ? "yes" : "no";
@@ -151,7 +151,7 @@ foreach (name : people) {
}
\end{codebox}
-As expected, \gls{MVEL} also implements the standard C \rbox{for} loop. Observe that newer versions of \gls{MVEL} allow an abbreviation of \rbox{foreach} to the usual \rbox{for} statement, as syntactic sugar. In order to explicitly indicate a collection iteration, we usually use \rbox{foreach} in the default rules for \arara, but both statements behave exactly the same from a semantic point of view.
+As expected, MVEL also implements the standard C \rbox{for} loop. Observe that newer versions of MVEL allow an abbreviation of \rbox{foreach} to the usual \rbox{for} statement, as syntactic sugar. In order to explicitly indicate a collection iteration, we usually use \rbox{foreach} in the default rules for \arara, but both statements behave exactly the same from a semantic point of view.
\begin{codebox}{Iteration statement}{teal}{\icnote}{white}
for (int i = 0; i < 100; i++) {
@@ -173,7 +173,7 @@ do {
} until (x == null);
\end{codebox}
-Finally, \gls{MVEL} also implements the standard \rbox{while}, with the significant addition of an \rbox{until} counterpart (for inverted logic):
+Finally, MVEL also implements the standard \rbox{while}, with the significant addition of an \rbox{until} counterpart (for inverted logic):
\begin{codebox}{Iteration statement}{teal}{\icnote}{white}
while (isTrue()) {
@@ -192,7 +192,7 @@ Since \rbox{while} and \rbox{until} are unbounded (i.e, the number of iterations
\section{Projections and folds}
\label{sec:mvelprojectionsandfolds}
-Projections are a way of representing collections. According to the official documentation, using a very simple syntax, one can inspect very complex object models inside collections in \gls{MVEL} using the \rbox{in} operator. For example:
+Projections are a way of representing collections. According to the official documentation, using a very simple syntax, one can inspect very complex object models inside collections in MVEL using the \rbox{in} operator. For example:
\begin{codebox}{Projection and fold}{teal}{\icnote}{white}
names = (user.name in users);
@@ -203,7 +203,7 @@ As seen in the above code, \rbox{names} holds all values from the \rbox{name} pr
\section{Assignments}
\label{sec:mvelassignments}
-According to the official documentation, the scripting language allows variable assignment in expressions, either for extraction from the runtime, or for use inside the expression. As \gls{MVEL} is a dynamically typed language, there is no need to specify a type in order to declare a new variable. However, feel free to explicitly declare the type when desired.
+According to the official documentation, the scripting language allows variable assignment in expressions, either for extraction from the runtime, or for use inside the expression. As MVEL is a dynamically typed language, there is no need to specify a type in order to declare a new variable. However, feel free to explicitly declare the type when desired.
\begin{codebox}{Assignment}{teal}{\icnote}{white}
str = "My string";
@@ -227,16 +227,16 @@ When writing rules for \arara, is advisable to keep variables to a minimum in or
\section{Basic templating}
\label{sec:mvelbasictemplating}
-\gls{MVEL} templates are comprised of \emph{orb} tags inside a plain text document. \Glspl{orb-tag} denote dynamic elements of the template which the engine will evaluate at runtime. \arara\ heavily relies on this concept for runtime evaluation of conditionals and rules. For rules, we use \glspl{orb-tag} to return either a string from a textual template or a proper command object. The former constituted the basis of command generation in previous versions of our tool; from version 4.0 on, we highly recommend the latter, detailed in Section~\ref{sec:rule}, on page~\ref{sec:rule}. Conditionals are in fact \glspl{orb-tag} in disguise, such that the expression (or a sequence of expressions) is properly evaluated at runtime. Consider the following example:
+MVEL templates are comprised of \emph{orb} tags inside a plain text document. Orb tags denote dynamic elements of the template which the engine will evaluate at runtime. \arara\ heavily relies on this concept for runtime evaluation of conditionals and rules. For rules, we use orb tags to return either a string from a textual template or a proper command object. The former constituted the basis of command generation in previous versions of our tool; we highly recommend the latter, detailed in Section~\ref{sec:rule}, on page~\ref{sec:rule}. Conditionals are in fact orb tags in disguise, such that the expression (or a sequence of expressions) is properly evaluated at runtime. Consider the following example:
\begin{codebox}{Template}{teal}{\icnote}{white}
My favourite team is @{ person.name == 'Enrico'
? 'Juventus' : 'Palmeiras' }!
\end{codebox}
-The above code features a basic form of \gls{orb-tag} named \emph{expression orb}. It contains an expression (or a sequence of expressions) which will be evaluated to a certain value, as seen earlier on, when discussing the \emph{last value out} principle. In the example, the value to be returned will be a string containing a football team name (the result is of course based on the comparison outcome).
+The above code features a basic form of orb tag named \emph{expression orb}. It contains an expression (or a sequence of expressions) which will be evaluated to a certain value, as seen earlier on, when discussing the \emph{last value out} principle. In the example, the value to be returned will be a string containing a football team name (the result is of course based on the comparison outcome).
\section{Further reading}
\label{sec:mvelfurtherreading}
-This chapter does not cover all features of the \gls{MVEL} expression language, so further reading is advisable. I highly recommend the \href{http://mvel.documentnode.com/}{MVEL language guide} currently covering version 2.0 of the language.
+This chapter does not cover all features of the MVEL expression language, so further reading is advisable. I highly recommend the \href{http://mvel.documentnode.com/}{MVEL language guide} currently covering version 2.0 of the language.