handouts/amm-ho.tex
changeset 760 d41956ea544e
parent 759 d70dd0b57e35
child 830 dbf9d710ce65
equal deleted inserted replaced
759:d70dd0b57e35 760:d41956ea544e
    75 \noindent
    75 \noindent
    76 This assumes the other Scala file is called
    76 This assumes the other Scala file is called
    77 \texttt{name-of-the-file.sc} and requires the file to be in the same
    77 \texttt{name-of-the-file.sc} and requires the file to be in the same
    78 directory where \texttt{amm} is working in. This will be very convenient 
    78 directory where \texttt{amm} is working in. This will be very convenient 
    79 for the compiler we implement in CFL, because it allows us to easily
    79 for the compiler we implement in CFL, because it allows us to easily
    80 break-up the code into the lexer, parser and code generator.
    80 break up the code into the lexer, parser and code generator.
    81 
    81 
    82 Another feature which exists in Ammonite, but not yet in the
    82 Another feature which exists in Ammonite, but not yet in the
    83 current version of Scala (it will be in the next version called dotty)
    83 current version of Scala (it will be in the next version called dotty)
    84 is that you can mark functions as \texttt{@main}. For example
    84 is that you can mark functions as \texttt{@main}. For example
    85 
    85 
   112 \end{lstlisting} %% $
   112 \end{lstlisting} %% $
   113 
   113 
   114 \noindent
   114 \noindent
   115 What is also good in Ammonite that you can specify more than one
   115 What is also good in Ammonite that you can specify more than one
   116 function to be ``main'' and then specify on the command line which
   116 function to be ``main'' and then specify on the command line which
   117 function do you want to run as entry-point.\bigskip
   117 function you want to run as entry-point.
       
   118 
       
   119 Another feature you might like to use is that Ammonite can ``watch'' files.
       
   120 This means it can automatically re-run a file when it is saved. For this
       
   121 you have to call \texttt{amm} with the option \texttt{-w}, as in
       
   122 
       
   123 \begin{lstlisting}[numbers=none,language=Scala]
       
   124 $ amm -w file.sc
       
   125 \end{lstlisting} %% $
       
   126 
       
   127 \noindent Of course this requires that you use \texttt{println} for
       
   128 inspecting any data, as otherwise nothing will be displayed at the
       
   129 commandline.
       
   130 \bigskip
   118 
   131 
   119 \noindent
   132 \noindent
   120 To sum up, Ammonite is a really useful addition to the Scala ecosystem.
   133 To sum up, Ammonite is a really useful addition to the Scala ecosystem.
   121 You can find more information about how to use it in the first five chapters
   134 You can find more information about how to use it in the first five chapters
   122 of the ``Hands-on Scala'' book by Li Haoyi. These chapters are
   135 of the ``Hands-on Scala'' book by Li Haoyi. These chapters are