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