fix example
[msc-thesis1617.git] / mtaskext.sdssem.tex
1 \Gls{mTask}-\glspl{SDS} on a client are available on the server as in the form
2 of regular \gls{iTasks}-\glspl{SDS}. However, the same freedom that an
3 \gls{SDS} has in the \gls{iTasks}-system is not given for \glspl{SDS} that
4 reside on the client. Not all types are suitable to be located on a client,
5 simply because it needs to be representable on clients. Also, not all \gls{SDS}
6 types are possible to have on a device. Moreover, \glspl{SDS} behave a little
7 different in an \gls{mTask} device compared to in the \gls{iTasks} system. In
8 an \gls{iTasks} system, when the \gls{SDS} is updated, a broadcast to all
9 watching \glspl{Task} in the system is made to notify them of the update.
10 \glspl{SDS} can update often and the update might not be the final value it
11 will get. Implementing the same functionality on the \gls{mTask} client would
12 result in a lot of expensive unneeded bandwidth usage. Therefore a device must
13 publish the \gls{SDS} explicitly to save bandwidth. Note that this means that
14 the \gls{SDS} value on the device can be different compared to the value of the
15 same \gls{SDS} on the server.
16
17 To add this functionality, the \CI{sds} class could be extended. However, this
18 would result in having to update all existing views that use the \CI{sds}
19 class. Therefore, an extra class is added that contains the extra
20 functionality. Programmers can choose to implement it for existing views in the
21 future but are not obliged to. The publication function has the following
22 signature:
23 \begin{lstlisting}[caption={The \texttt{sdspub} class}]
24 class sdspub v where
25 pub :: (v t Upd) -> v t Expr | type t
26 \end{lstlisting}
27
28 Moreover, \glspl{SDS} in the \gls{mTask}-\gls{EDSL} are always anonymous. There
29 is no way of labeling it since it is not a real entity, it is just a function.
30 When an \gls{SDS} is sent to the device it must be retrievable and
31 identifiable. It is not always clear which instantiated \gls{SDS} is which.
32 Therefore, an added class named \CI{namedsds} is added that provides the exact
33 same functionality as the \gls{SDS} class but adds a \CI{String} parameter that
34 can later be used to identify an \gls{SDS}. The types for this class are as
35 follows:
36
37 \begin{lstlisting}[caption={The \texttt{namedsds} class}]
38 class namedsds v where
39 namedsds :: ((v t Upd)->In (Named t String) (Main (v c s))) -> (Main (v c s)) | type, mTaskType, toCode t
40 :: Named a b = Named infix 1 a b
41 \end{lstlisting}