

% add the PATH to retrieve cls and sty beamer styles files
\makeatletter
\providecommand*{\input@path}{}
\edef\input@path{{../../support/beamer/}\input@path}% prepend
\makeatother

% \documentclass{pharoslides}
% \documentclass[aspectratio=169]{pharoslides} % format 16/9
\documentclass[withvideo]{pharoslides} % format 16/9 + incrustation video

\graphicspath{{./figures/}{../}{../../support/beamer/imgs/}}

%Information to be included in the title page:
\title{Messages: Composition and Precedence}
\subtitle{}
\author{Damien Cassou, Stéphane Ducasse and Luc Fabresse}
\institute{http://stephane.ducasse.free.fr}
\date{}
\slidesid{W2S03}

\begin{document}

\frame[plain]{\titlepage}



\begin{frame}[fragile]

\frametitle{Composition: from Left to Right!}

What happens when we have two messages of the same kind?

\begin{itemize}
\item Execution from left to right
\end{itemize}

\begin{listing}{}
1000 factorial class name  
> 'LargePositiveInteger'
\end{listing}

is equivalent to 

\begin{listing}{}
(((1000 factorial) class) name) 
\end{listing}

\begin{itemize}
\item Ease the composition of messages
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Complete Message Precedence}

\begin{itemize}
\item (Msg) \textgreater{} Unary \textgreater{} Binary \textgreater{} Keywords
\item From left to right
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Precedence Example}

\begin{listing}{}
2 + 3 squared
> 2 + 9
> 11
\end{listing}

\begin{itemize}
\item unary (squared) first 
\item then binary (\code{+})
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Precedence Example}

\begin{listing}{}
2 raisedTo: 3 + 2
> 2 raisedTo: 5
> 32
\end{listing}

\begin{itemize}
\item binary (\code{+}) first 
\item then keyword-based (\code{raisedTo:})
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Precedence Example}

\begin{listing}{}
Color gray - Color white = Color black
> aGray - aWhite = aBlack
> aBlack = aBlack
> true
\end{listing}

\begin{itemize}
\item unary messages
\item then binary from left to right
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Precedence Example}

\begin{listing}{}
1 class maxVal + 1 
> 1073741824
\end{listing}

\begin{itemize}
\item unary, unary and binary
\end{itemize}

\begin{listing}{}
1 class
> SmallInteger

1 class maxVal
> 1073741823
	
1 class maxVal + 1
> 1073741824
	
(1 class maxVal + 1) class
> LargePositiveInteger
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Parentheses take Precedence!}

\begin{listing}{}
0@0 extent: 100@100 bottomRight
> Message not understood
> 100 does not understand bottomRight
\end{listing}

Should use \code{()}

\begin{listing}{}
(0@0 extent: 100@100) bottomRight
> (aPoint extent: anotherPoint) bottomRight
> aRectangle bottomRight
> 100@100
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{The Price for Simplicity}

Only messages:

\begin{itemize}
\item \code{+} 
\begin{itemize}
\item is a message, no precedence
\item can be redefined in domain classes 
\end{itemize}

\item Simple
\item One limit: no mathematical precedence
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{No Mathematical Precedence}

\begin{listing}{}
3 + 2 * 10
> 5 * 10
> 50
\end{listing}

\begin{itemize}
\item should be rewritten using parentheses
\end{itemize}

\begin{listing}{}
3 + (2 * 10)
> 3 + 20
> 23
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{No Mathematical Precedence}

\begin{listing}{}
1/3 + 2/3
> 7/3 /3
> 7/9
\end{listing}

\begin{itemize}
\item should be rewritten using parentheses
\end{itemize}

\begin{listing}{}
(1/3) + (2/3)
> 1
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Summary}

\begin{itemize}
\item Three kinds of messages: unary, binary and keywords
\item (...) \textgreater{} unary \textgreater{} binary \textgreater{} keywords
\item Then from left to right
\item There is no mathematical precedence because mathematical operations are plain messages
\item Arguments are placed inside message structure: 
\begin{itemize}
\item 2 between: 0 and: 5 (the message is \code{between:and:})
\end{itemize}

\end{itemize}
\end{frame}




% \setlength{\textwidth}{\originaltextwidth}
\setbeamertemplate{background canvas}{\insertBorderForHandout}

\begin{frame}[plain]

\begin{minipage}{\originaltextwidth}
\centering
\large


\vspace{2em}

A course by

\vspace{1em}

\hspace{-20px}\includegraphics[height=32px]{inriaLogo}\hspace{3em}\raisebox{7px}{and}\hspace{3em}\raisebox{-6px}{\includegraphics[height=30px]{logoutop}}

\vspace{2em}

in collaboration with

\vspace{1em}

\includegraphics[height=40px]{unisciellogo}\hskip 1.5em%
\raisebox{5px}{\includegraphics[height=30px]{unitlogo}}\hskip 2em%
\raisebox{8px}{\includegraphics[height=24px]{univLilleLogo}}\hskip 2em%
\raisebox{3px}{\includegraphics[height=29px]{logo-IMT}}\hskip 2em%
\raisebox{1px}{\includegraphics[height=32px]{minesDouaiLogo}}

\vspace{2.5em}

\includegraphics[width=50px]{by-nc-nd} \tiny \hskip 0.5em \raisebox{5px}{Inria 2016}

\medskip

\tiny
Except where otherwise noted, this work is licensed under CC BY-NC-ND 3.0 France

\url{https://creativecommons.org/licenses/by-nc-nd/3.0/fr/} 

\end{minipage}
\end{frame}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
