<s>
Multitier	B-Application
programming	I-Application
(	O
or	O
tierless	O
programming	O
)	O
is	O
a	O
programming	O
paradigm	O
for	O
distributed	B-Architecture
software	I-Architecture
,	O
which	O
typically	O
follows	O
a	O
multitier	B-Operating_System
architecture	I-Operating_System
,	O
physically	O
separating	O
different	O
functional	O
aspects	O
of	O
the	O
software	O
into	O
different	O
tiers	B-Operating_System
(	O
e.g.	O
,	O
the	O
client	O
,	O
the	O
server	O
and	O
the	O
database	O
in	O
a	O
Web	O
application	O
)	O
.	O
</s>
<s>
Multitier	B-Application
programming	I-Application
allows	O
functionalities	O
that	O
span	O
multiple	O
of	O
such	O
tiers	B-Operating_System
to	O
be	O
developed	O
in	O
a	O
single	O
compilation	B-Language
unit	O
using	O
a	O
single	O
programming	O
language	O
.	O
</s>
<s>
Without	O
multitier	B-Application
programming	I-Application
,	O
tiers	B-Operating_System
are	O
developed	O
using	O
different	O
languages	O
,	O
e.g.	O
,	O
JavaScript	B-Language
for	O
the	O
Web	O
client	O
,	O
PHP	B-Application
for	O
the	O
Web	O
server	O
and	O
SQL	B-Language
for	O
the	O
database	O
.	O
</s>
<s>
Multitier	B-Application
programming	I-Application
is	O
often	O
integrated	O
into	O
general-purpose	B-General_Concept
languages	I-General_Concept
by	O
extending	O
them	O
with	O
support	O
for	O
distribution	O
.	O
</s>
<s>
and	O
have	O
found	O
industrial	O
adoption	O
in	O
solutions	O
such	O
as	O
Ocsigen	O
,	O
Opa	B-Language
,	O
WebSharper	B-Application
,	O
Meteor	B-Language
or	O
GWT	B-Language
.	O
</s>
<s>
Multitier	B-Application
programming	I-Application
is	O
provides	O
a	O
global	O
view	O
on	O
the	O
distributed	B-Architecture
system	I-Architecture
.	O
</s>
<s>
This	O
aspect	O
has	O
been	O
shown	O
similar	O
to	O
other	O
programming	O
paradigms	O
such	O
as	O
choreographic	B-Application
programming	I-Application
,	O
macroprogramming	O
,	O
and	O
aggregate	O
computing	O
.	O
</s>
<s>
The	O
code	O
of	O
the	O
different	O
tiers	B-Operating_System
can	O
be	O
executed	O
in	O
a	O
distributed	O
manner	O
on	O
different	O
networked	B-Architecture
computers	I-Architecture
.	O
</s>
<s>
For	O
instance	O
,	O
in	O
a	O
three-tier	B-Operating_System
architecture	I-Operating_System
,	O
a	O
system	O
is	O
divided	O
into	O
three	O
main	O
layers	O
–	O
typically	O
the	O
presentation	O
,	O
business	O
,	O
and	O
data	O
tiers	B-Operating_System
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
this	O
architectural	O
decision	O
scatters	O
a	O
cross-cutting	O
functionality	O
belonging	O
to	O
several	O
tiers	B-Operating_System
over	O
several	O
compilation	B-Language
units	O
.	O
</s>
<s>
In	O
multitier	B-Application
programming	I-Application
,	O
the	O
different	O
tiers	B-Operating_System
are	O
implemented	O
using	O
a	O
single	O
programming	O
language	O
.	O
</s>
<s>
Different	O
compilation	B-Language
backends	I-Language
take	O
into	O
account	O
the	O
destination	O
tier	B-Operating_System
(	O
e.g.	O
,	O
Java	O
for	O
a	O
server	O
and	O
JavaScript	B-Language
for	O
a	O
web	O
browser	O
)	O
.	O
</s>
<s>
Consequently	O
,	O
a	O
functionality	O
that	O
is	O
spread	O
over	O
tiers	B-Operating_System
can	O
be	O
implemented	O
in	O
a	O
single	O
compilation	B-Language
unit	O
of	O
a	O
multitier	B-Operating_System
program	O
.	O
</s>
<s>
At	O
their	O
core	O
,	O
multitier	B-Operating_System
languages	O
allow	O
developers	O
to	O
define	O
for	O
different	O
pieces	O
of	O
code	O
the	O
tiers	B-Operating_System
to	O
which	O
the	O
code	O
belongs	O
.	O
</s>
<s>
The	O
language	O
features	O
that	O
enable	O
this	O
definition	O
are	O
quite	O
diverse	O
between	O
different	O
multitier	B-Operating_System
languages	O
,	O
ranging	O
from	O
staging	B-Application
to	O
annotations	O
to	O
types	O
.	O
</s>
<s>
Hop	B-Application
uses	O
staging	B-Application
to	O
embed	O
code	O
that	O
is	O
to	O
be	O
run	O
on	O
the	O
client	O
into	O
a	O
server-side	O
program	O
:	O
Using	O
the	O
~{…}	O
notation	O
,	O
the	O
code	O
for	O
the	O
onload	O
(	O
Line	O
4	O
)	O
and	O
onclick	O
(	O
Line	O
10	O
)	O
handlers	O
is	O
not	O
immediately	O
executed	O
but	O
the	O
server	O
generates	O
the	O
code	O
for	O
later	O
execution	O
on	O
the	O
client	O
.	O
</s>
<s>
The	O
expressions	O
hop.port	O
(	O
Line	O
5	O
)	O
,	O
event.data	O
(	O
Line	O
6	O
)	O
and	O
input	O
(	O
Line	O
9	O
and	O
10	O
)	O
are	O
evaluated	O
by	O
the	O
outer	O
server	O
program	O
and	O
the	O
values	O
to	O
which	O
they	O
evaluate	O
are	O
injected	O
into	O
the	O
generated	O
client	O
program	O
.	O
</s>
<s>
Hop	B-Application
supports	O
full	B-Application
stage	I-Application
programming	I-Application
,	O
i.e.	O
,	O
~{…}	O
expressions	O
can	O
be	O
arbitrarily	O
nested	O
such	O
that	O
not	O
only	O
server-side	O
programs	O
can	O
generate	O
client-side	O
programs	O
but	O
also	O
client-side	O
programs	O
are	O
able	O
to	O
generate	O
other	O
client-side	O
programs	O
.	O
</s>
<s>
HTML	O
can	O
be	O
embedded	O
directly	O
in	O
Hop	B-Application
code	O
.	O
</s>
<s>
Hop	B-Application
supports	O
bidirectional	O
communication	O
between	O
a	O
running	O
server	O
and	O
a	O
running	O
client	O
instance	O
through	O
its	O
standard	O
library	O
.	O
</s>
<s>
The	O
code	O
to	O
be	O
executed	O
for	O
the	O
l:onsubmit	O
handler	O
(	O
Line	O
9	O
)	O
is	O
not	O
immediately	O
executed	O
but	O
compiled	B-Language
to	O
JavaScript	B-Language
for	O
client-side	O
execution	O
.	O
</s>
<s>
Client	O
–	O
server	O
interaction	O
is	O
based	O
on	O
resumption	O
passing	O
style	O
:	O
Using	O
continuation	B-Application
passing	I-Application
style	I-Application
transformation	O
and	O
defunctionalization	B-Application
,	O
remote	O
calls	O
are	O
implemented	O
by	O
passing	O
the	O
name	O
of	O
a	O
function	O
for	O
the	O
continuation	O
and	O
the	O
data	O
needed	O
to	O
continue	O
the	O
computation	O
.	O
</s>
<s>
ScalaLoci	O
is	O
a	O
language	O
that	O
targets	O
generic	O
distributed	B-Architecture
systems	I-Architecture
rather	O
than	O
the	O
Web	O
only	O
,	O
i.e.	O
,	O
it	O
is	O
not	O
restricted	O
to	O
a	O
client	O
–	O
server	O
architecture	O
.	O
</s>
<s>
To	O
this	O
end	O
,	O
ScalaLoci	O
supports	O
peer	O
types	O
to	O
encode	O
the	O
different	O
tiers	B-Operating_System
at	O
the	O
type	O
level	O
.	O
</s>
<s>
ScalaLoci	O
supports	O
multitier	B-Operating_System
reactives	B-Application
–	O
language	O
abstractions	O
for	O
reactive	O
programming	O
that	O
are	O
placed	O
on	O
specific	O
locations	O
–	O
for	O
composing	O
data	O
flows	O
cross	O
different	O
peers	O
.	O
</s>
