%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\part[Syntax]{Die Syntax von Perl 6}
\section{Syntax}

\begin{frame}
	\frametitle{Perl 6's Syntax}
	Teil 1 - Die Syntax von Perl 6
\end{frame}

\subsection{Grundlagen}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Hallo, Perl!}

	\begin{block}{Perl soll Perl bleiben}
	Daher: Die grundsätzliche Syntax bleibt erhalten\\
	\end{block}
	\ \\
	\uncover<2->{
		\input{code/syn/hallo1.pl.tex}
		\ \\
		\input{code/syn/hallo2.pl.tex}
	}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Unterscheidung von Perl 5 und 6}

	\begin{block}{Abwärtskompatibiliät}
	Solange perl nicht mit Sicherheit sagen kann, ob
	Perl 5 oder Perl 6 Code vorliegt, geht der Parser
	davon aus, das es sich um Perl 5 handelt.
	\end{block}
	
	\begin{block}{Perl 6}
	"\texttt{use v6;}" ist der offizielle Weg, Perl 6 Code zu kennzeichnen
	\end{block}
	
	\begin{block}{Beispiele in dieser Präsentation}
	für Perl 5 Code benutze ich hauptsächlich "\texttt{print}", für Perl 6 "\texttt{say}"
	\end{block}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Anweisungen}
	
	\begin{block}{Anweisungen}
	... enden weiterhin mit einem Semikolon \\
	\uncover<2->{... bei der letzten Anweisung eines Blockes ist es jedoch weiterhin optional}
	\ \\
	\ \\
	\uncover<3->{
	$\Rightarrow$ Das Semikolon ist ein Anweisungsseperator,\\
	kein Anweisungsterminator wie z.B. in C/C++ und Java.}
	\end{block}
\end{frame}

\subsection{Kommentare}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Kommentare}
	\input{code/syn/kommentare.pl.tex}
\end{frame}


\subsection{Variablen}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Variablen}
	\input{code/syn/vars1.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{Variablen}
	\input{code/syn/vars2.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{Variablen}
	\input{code/syn/vars3.pl.tex}
\end{frame}


\subsection{Otto und sein Hund}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Perl 5 Beispiel}
	\input{code/syn/otto1.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{Perl 6 Beispiel (1)}
	\input{code/syn/otto2.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{Perl 6 Beispiel (2)}
	\input{code/syn/otto3.pl.tex}
\end{frame}



\subsection{Schlüsselwörter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Schlüsselworter}
	
	\begin{block}{Perl 5 und 6}
	my, our, sub
	\end{block}
	\begin{block}{neu in Perl 6}
	temp, let, state, class, method, \textellipsis
	\end{block}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{temp}
	\input{code/syn/temp1.pl.tex}
\end{frame}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{frame}
% 	\frametitle{temp}
% 	\input{code/syn/temp2.pl.tex}
% \end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Schlüsselworter}
	\input{code/syn/let1.pl.tex}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{state}
	\input{code/syn/state1.pl.tex}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{state}
	\input{code/syn/state2.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{class und method}
	Wird ausführlicher im 3. Teil behandelt!
	\ \\
	\ \\
	\input{code/syn/class.pl.tex}
\end{frame}




\subsection{Programmfluß-Kontrolle}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Kontrollstrukturen}
	
	\begin{block}{Perl 5}
	if, for/foreach, while/until, \textellipsis
	\end{block}
	\begin{block}{Perl 6}
	if, loop/for, while/until, \textellipsis
	\end{block}
\end{frame}

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{frame}
% 	\frametitle{if}
%  	\input{code/syn/if1.pl.tex}
% \end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{for}
	\input{code/syn/for1.pl.tex}
	\input{code/syn/for2.pl.tex}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{for}
	\input{code/syn/for2.pl.tex}
	\input{code/syn/for3.pl.tex}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{C-ähnliche Schleifen}
	\input{code/syn/loop1.pl.tex}
	\input{code/syn/loop2.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{"endlos"-Schleifen}
	\input{code/syn/loop3.pl.tex}
	\input{code/syn/loop4.pl.tex}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{while}
	\input{code/syn/while1.pl.tex}
	\input{code/syn/while2.pl.tex}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{do...while}
	\input{code/syn/while3.pl.tex}
	\input{code/syn/while4.pl.tex}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{given...when}
	\input{code/syn/given1.pl.tex}
\end{frame}




\subsection{Interpolation}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{interpolierte Funktions-Aufrufe}
	\input{code/syn/interp1.pl.tex}
	\input{code/syn/interp2.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{interpolierte Funktions-Aufrufe}
	\input{code/syn/interp3.pl.tex}
	\input{code/syn/interp4.pl.tex}
\end{frame}



% \subsection{Exceptions}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \begin{frame}
% %  CATCH { 
% %       when Err::Danger { warn "fly away home"; }
% %   }
% % 
% % The $! object will also stringify to its text message if you match it against a pattern.
% %
% %  try {
% %      may_throw_exception();
% %   CATCH {
% %       when /:w I'm sorry Dave/ { warn "HAL is in the house."; }
% %   }
% % }
% \end{frame}


\subsection{Traits}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Unicode}
	\input{code/syn/traits1.pl.tex}
\end{frame}


\subsection{Unicode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Unicode}
	
	Unicode
	\begin{itemize}
	\item wird bereits in Perl 5 teilweise unterstützt (use utf8;)
	\uncover<2->{
	\item \textellipsis aber nur sehr eingeschränkt, z.B. nicht in Sub-Namen
	}
	\uncover<3->{
	\item Perl 6 wird Unicode uneingeschränkt unterstützen
	}
	\uncover<4->{
	\item \textellipsis das Problem, dass Unicode-Zeichen in Dateinamen nicht\\
	portabel sind ist bislang jedoch noch ungelößt.
	}
	\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Programme mit Unicode-Zeichen}
	
	Perl 5 und Unicode-Zeichen...
	
	\input{code/syn/waehrung1.pl.tex}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Funktionen mit Unicode-Zeichen}
	
	Perl 6: Unicode-Zeichen sogar in Bezeichnernamen:
	
	\input{code/syn/waehrung2.pl.tex}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
	\frametitle{Funktionen mit Unicode-Zeichen}
	
	In Perl 5 werden zwar auch einige Unicode-Zeichen in Sub-Namen akzeptiert,
	aber es sind recht wenige und es wird offiziell nicht unterstützt.
	
	\input{code/syn/summe1.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{Funktionen mit Unicode-Zeichen}
	
	In Perl 6 wird Unicode standardmäßig unterstützt:
	
	\input{code/syn/summe2.pl.tex}
\end{frame}
\begin{frame}
	\frametitle{Funktionen mit Unicode-Zeichen}
	
	Perl 6 hat jede Menge coole Operatoren:
	
	\input{code/syn/summe3.pl.tex}
	\ \\
	Sie werden nun im nächsten Abschnitt behandelt.
\end{frame}
