Skip to content

Commit

Permalink
Merge pull request #225 from hpi-swa-lab/misc-3
Browse files Browse the repository at this point in the history
misc-3
  • Loading branch information
LinqLover authored Dec 16, 2023
2 parents 0d76baf + b82f79d commit b3694e3
Show file tree
Hide file tree
Showing 18 changed files with 97 additions and 78 deletions.
22 changes: 11 additions & 11 deletions BasicClasses/BasicClasses.tex
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ \section{Object}
%-----------------------------------------------------------------
\subsection{Printing}
Every object in Smalltalk can return a printed form of itself.
You can select any expression in a workspace and select the \menu{print it} menu item:
You can select any expression in a workspace and select the \menu{print it} menu item: \index{print it}
This executes the expression and asks the returned object to print itself.
In fact, this sends the message \ct{printString} to the returned object.
The method \mthind{Object}{printString}, which is a \ind{template method}, at its core sends the message \mthind{Object}{printOn:} to its receiver.
Expand Down Expand Up @@ -951,9 +951,9 @@ \section{Exceptions}
Using \ct{pass}, you can design your exception handlers to only handle some exceptions based on their state and pass all others to the next handler:
\begin{code}{NB: CANNOT TEST}
[self downloadData]
on: ConnectionRefused do: [:ex |
self cache at: ex host ifAbsent: [ex pass]].
[self downloadData]
on: ConnectionRefused do: [:ex |
self cache at: ex host ifAbsent: [ex pass]].
\end{code}
This example tries to download some data from a server, but if the connection is refused, it will try to fallback to an offline cache.
Expand All @@ -968,11 +968,11 @@ \section{Exceptions}
For instance, most dialogs in \sq signal a \clsind{ProvideAnswerNotification} before they show up to the user, which allows the code that eventually triggered the dialog to automatically answer the question:
\begin{code}{NB: CANNOT TEST}
Morph new exportAsPNG. --> "a file dialog opens for entering a file name"
Morph new exportAsPNG. --> "a file dialog opens for entering a file name"
[Morph new exportAsPNG]
on: ProvideAnswerNotification
do: [:ex | ex resume: 'myMorph.png']. --> "no dialog opens, the file is saved as 'myMorph.png'"
[Morph new exportAsPNG]
on: ProvideAnswerNotification
do: [:ex | ex resume: 'myMorph.png']. --> "no dialog opens, the file is saved as 'myMorph.png'"
\end{code}
Note that specifically for handling \clsindplural{ProvideAnswerNotification}, there are the more convenient methods \cmind{BlockClosure}{valueSupplyingAnswers:} and \cmind{BlockClosure}{valueSuppressingMessages:}.
Expand All @@ -986,9 +986,9 @@ \section{Exceptions}
For instance, the following would be equivalent to the first example above:
\begin{code}{@TEST}
[(-2 to:2) collect: [:i | 100 / i]]
on: ZeroDivide
do: [:ex | ex return: nil].
[(-2 to:2) collect: [:i | 100 / i]]
on: ZeroDivide
do: [:ex | ex return: nil].
\end{code}
\end{itemize}
Expand Down
12 changes: 6 additions & 6 deletions Bibliography/LatexTemplates/st80demo.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ \section*{Code environments using the listings package}

%=============================================================
\subsection*{Listings environments and macros}
The code environments
The code environments

\begin{verbatim}
\begin{code}
...
...
\end{code}
\end{verbatim}
take plain, verbatim code,
Expand All @@ -39,12 +39,12 @@ \subsection*{Listings environments and macros}
true & false not & (nil isNil) ifFalse: [self halt].
y _ self size + super size.
#($a #a 'a' 1 1.0)
do: [:each | Transcript
show: (each class name);
do: [:each | Transcript
show: (each class name);
show: ' ';
show: (each printString).
{ 1 + 2 . 3 \\ 4 . 1 << 3. 2 >> 5 . 1 % 2 }.
^ x < y
^ x < y
\end{code}
QWERTY layout:
Expand All @@ -70,7 +70,7 @@ \subsection*{Listings environments and macros}
plain code and !\textbf{bolded text}!
\end{code}
% ^ $ \\ % # '
% ^ $ \\ % # '
In-line code with \verb|\ct| is typed like this \verb|\ct{1 + 2 --> 3}| and looks like this: \ct{1 + 2 --> 3}, text can follow immediately. The ``brackets'' around \verb|\ct| can be any matching pair of characters, useful if you want \ct${ and }$ in the code.
Expand Down
1 change: 0 additions & 1 deletion Collections/Collections.tex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ \chapter{Collections}
%\sd{Did a first pass: I should have a look at Xavier Briffault's book and at the material mentionned by andrew + lalonde book?}
%\pre{Removed the abstract, high-level, number-heavy introduction on the collection hierarchy}
%=============================================================
\section{Introduction}

To make good use of the collection classes, \st programmers need at least an overview of the wide variety of collections and their commonalities and differences.
%
Expand Down
9 changes: 5 additions & 4 deletions Environment/Environment.tex
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ \subsubsection{Browsing code}
When you are writing code you will almost certainly need at least two: one for the method that you are typing, and another to browse around the system to see what to type.
You can also open a browser on a class named by any selected text using the \short{b} keyboard shortcut.
\index{system browser!browse button}
\index{keyboard shortcuts!browse it}
\index{browse it}

\dothis{Try this: in a workspace window, type the name of a class (for instance \ct{ScaleMorph}), select it, and then press \short{b}. This trick is often useful; it works in any text window.}

Expand Down Expand Up @@ -608,6 +608,7 @@ \section{The inspector and the explorer}
\subsection{The inspector}

\dothis{As an illustration of what you can do with an \ind{inspector}, type \ct{TimeStamp now} in a workspace, and then choose \menu{inspect it} from the \ind{yellow button} menu.
\index{inspect it}
(It's not necessary to select the text before using the menu; if no text is selected, the menu operations work on the whole of the current line.
You can also type \short{i} for \menu{\textbf{i}nspect it}.)}
\clsindex{TimeStamp}
Expand Down Expand Up @@ -790,7 +791,7 @@ \subsection{The instance browser}
However, this window is more interesting as it still knows about the \ct{PluggableListMorph} for which we opened it.
Thus, we can evaluate code in the code pane.

\dothis{In the browser, open the method \ct{fullListSize} by selecting it in the list at the top right. Then, navigate to the last code line and \menu{print it} (\short{p}). You should see the result of evaluating the expression right within the code editor.}
\dothis{In the browser, open the method \ct{fullListSize} by selecting it in the list at the top right. Then, navigate to the last code line and \menu{print it} (\short{p}). \index{print it} You should see the result of evaluating the expression right within the code editor.}

\begin{ExecuteSmalltalkScript}
SBEScreenshotRecorder writeTo: './figures/instanceBrowser.png' building: [:helper |
Expand Down Expand Up @@ -1275,7 +1276,7 @@ \section{The process browser}
\figref{processBrowser} shows a screenshot.
The top-left pane lists all of the processes in \sq, in priority order, from the timer interrupt watcher at priority 80 to the idle process at priority 10.
Of course, on a uniprocessor, when you look which program is running, the only process that can be running is the UI process, as it is currently displaying the information to you; all of the other will be waiting for some kind of event.
By default, the display of processes is static; it can be updated using the \ind{yellow button} menu, which also provides an option to \menu{turn on auto-update (a)}
By default, the display of processes is static; it can be updated using the \ind{yellow button} menu, which also provides an option to \menu{turn on auto-update (a)}.
If you select a process in the top-left pane, its stack trace is displayed in the top-right pane, just as with the debugger.
If you select a stack frame, the corresponding method is displayed in the bottom pane.
Expand Down Expand Up @@ -1409,7 +1410,7 @@ \section{Other interesting tools}
\begin{minipage}[t]{0.48\textwidth}
\ifluluelse
{\includegraphics[width=\textwidth]{SpaceTally}}
{\includegraphics[scale=0.7]{exploreWithLabel: 'SpaceTally'}}
{\includegraphics[scale=0.7]{SpaceTally}}
\label{fig:SpaceTally}
\end{minipage}
\caption{A time profiler (left) and a space tally (right).}
Expand Down
6 changes: 3 additions & 3 deletions FAQ/FAQ.tex
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ \section{Browsing the system}
\end{faq}
\answer
\short{b} (browse) on the class name, \short{f} in the category pane of the class browser, or the global search on the top right of the world.
\index{keyboard shortcuts!browse it}
\index{browse it}
\index{keyboard shortcuts!find ...}

\begin{faq}
Expand Down Expand Up @@ -302,7 +302,7 @@ \section{Using Monticello and SqueakSource}
\end{faq}
\answer
\begin{enumerate}
\item Find the project you want in \url{squeaksource.com}
\item Find the project you want in \url{https://squeaksource.com}
\item Copy the registration code snippet
\item Select \menu{World docking bar~\go{} Tools~\go{} Monticello browser}
\item Select \menu{+Repository~\go{} HTTP}
Expand All @@ -316,7 +316,7 @@ \section{Using Monticello and SqueakSource}
\end{faq}
\answer
\begin{enumerate}
\item Go to \url{squeaksource.com}
\item Go to \url{https://squeaksource.com}
\item Register yourself as a new member
\item Register a project (name = category)
\item Copy the Registration code snippet
Expand Down
23 changes: 12 additions & 11 deletions FirstApp/FirstApp.tex
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ \section{Creating a new class category}

We have already seen the \ind{system browser} in \charef{quick}, where we learned how to navigate to classes and methods, and saw how to define new methods.
Now we will see how to create system categories and classes.
\seeindex{system category}{category}
\seeindex{system category}{category, system}
\seeindex{class category}{system category}
\index{category!creating}

Expand Down Expand Up @@ -133,16 +133,16 @@ \section{Defining the class SBECell}

As yet there are of course no classes in the new category.
However, the main editing pane displays a template to make it easy to create a new class (see \figref{classTemplate}).
This template shows us a \st expression that sends a message to a class called \ct{Object}, asking it to create a subclass called \ct{NameOfSubClass}.
This template shows us a \st expression that sends a message to a class called \ct{Object}, asking it to create a subclass called \ct{NameOfSubclass}.
The new class has no variables and should belong to the category \scat{SBE-Quinto}.
We now modify the template to create the class that we want.

\dothis{Modify the class creation template as follows:}
\begin{itemize}
\begin{enumerate}
\item Replace \clsind{Object} by \clsind{SimpleSwitchMorph}.
\item Replace \ct{NameOfSubClass} by \clsind{SBECell}.
\item Replace \ct{NameOfSubclass} by \clsind{SBECell}.
\item Add \ct{mouseAction} to the list of instance variables.
\end{itemize}
\end{enumerate}
The result should look like \clsref{firstClassDef}.

\begin{classdef}[firstClassDef]{Defining the class \ct| SBECell|.}
Expand Down Expand Up @@ -289,7 +289,8 @@ \section{Inspecting an object}
You can test the effect of the code you have written by creating a new \ct{SBECell} object and inspecting it.

\dothis{Open a workspace.
Type the expression \ct{SBECell new} and \menu{inspect it}.}
Type the expression \ct{SBECell new} and \menu{inspect it}.
\index{inspect it}}

\begin{ExecuteSmalltalkScript}
SBEScreenshotRecorder writeTo: './figures/SBECellInspector.png' frame: #morphs building: [:helper |
Expand Down Expand Up @@ -767,7 +768,7 @@ \section{Saving and sharing Smalltalk code}
The yellow-button menu in the System Categories pane will give you the option to file out the whole of category \scat{SBE-Quinto}.
The resulting file is more or less human-readable, but is really intended for computers, not humans.
You can email this file to your friends, and they can file it into their own \squeak images using drag-and-drop.
\seeindex{saving code}{categories}
\seeindex{saving code}{file, filing out}
\seeindex{category!filing out}{file, filing out}
\seeindex{class!filing out}{file, filing out}
\seeindex{method!filing out}{file, filing out}
Expand All @@ -786,7 +787,7 @@ \section{Saving and sharing Smalltalk code}

\subsection{Monticello packages}
Although fileouts are a convenient way of making a snapshot of the code you have written, they do not work well for long-running projects.
Just as most open-source projects find it much more convenient to maintain their code in a repository using \ind{Git}\footnote{\url{www.git-scm.com}} or \ind{Mercurial}\footnote{\url{www.mercurial-scm.org}}, so \squeak programmers find it more convenient to manage their code using \ind{Monticello} packages.
Just as most open-source projects find it much more convenient to maintain their code in a repository using \ind{Git}\footnote{\url{https://www.git-scm.com}} or \ind{Mercurial}\footnote{\url{https://www.mercurial-scm.org}}, so \squeak programmers find it more convenient to manage their code using \ind{Monticello} packages.
These packages are represented as files with names ending in \ct{.mcz}; they are actually zip-compressed bundles that contain the complete code of your \ind{package}.

Using the Monticello package browser, you can save packages to repositories on various types of servers, including FTP and HTTP servers; you can also just write the packages to a repository in a local file system directory.
Expand Down Expand Up @@ -833,12 +834,12 @@ \subsection{Saving and loading code with Monticello}

\subsection{\ind{SqueakSource}: a sharing platform for Monticello}
We think that the best way to save your code and share it is to create an account for your project on a SqueakSource server.
SqueakSource is similar to GitHub\footnote{\url{www.github.com}}:
SqueakSource is similar to GitHub\footnote{\url{https://www.github.com}}:
It is a web front-end to an HTTP Monticello server that lets you manage your projects.
There is a public SqueakSource server at \url{http://www.squeaksource.com}, and a copy of the code related to our game is stored there at \sbeSqueaksourceUrl.
There is a public SqueakSource server at \url{https://www.squeaksource.com}, and a copy of the code related to our game is stored there at \sbeSqueaksourceUrl.
You can look at this project with a web browser, but it's a lot more productive to do so from inside \squeak, using the Monticello browser, which lets you manage your packages.

\dothis{Open a web browser to \url{www.squeaksource.com}.
\dothis{Open a web browser to \url{https://www.squeaksource.com}.
Create an account for yourself and then create (\ie ``register'') a project for the Quinto game.}
SqueakSource will show you the information that you should use when adding a repository using the Monticello browser.

Expand Down
2 changes: 1 addition & 1 deletion Model/Model.tex
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ \section{Everything happens by sending messages}

One of the consequences of \st's model of message sending is that it encourages a style in which objects tend to have very small methods and delegate tasks to other objects, rather than implementing huge, procedural methods that assume too much responsibility.
Joseph Pelrine expresses this principle succinctly as follows:
\important{Don not do anything that you can push off onto someone else.}
\important{Do not do anything that you can push off onto someone else.}
\index{Pelrine, Joseph}
\ab{Citation?}
\on{sorry, just personal communication and my own lecture notes!}
Expand Down
8 changes: 4 additions & 4 deletions Morphic/Morphic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -659,10 +659,10 @@ \subsection{Morphic animations}
\dothis{Add the following code to \mthref{handleKeystroke}:}

\begin{code}{}
keyValue = $+ asciiValue
ifTrue: [self startStepping].
keyValue = $- asciiValue
ifTrue: [self stopStepping].
keyValue = $+ asciiValue
ifTrue: [self startStepping].
keyValue = $- asciiValue
ifTrue: [self stopStepping].
\end{code}

% \on{You can also \menu{debug~\go{} inspect morph} and evaluate: \ct{self currentWorld startStepping: self}.}
Expand Down
19 changes: 10 additions & 9 deletions Preface/Preface.tex
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ \section*{An open book}

\item The content of this book is released under the Creative Commons Attribution-ShareAlike (by-sa) license.
In short, you are allowed to freely share and adapt this book, as long as you respect the conditions of the license available at the following URL:
\url{creativecommons.org/licenses/by-sa/3.0/}.
\url{https://creativecommons.org/licenses/by-sa/3.0/}.

\item This book just describes the core of \sq.
Ideally, we would like to encourage others to contribute chapters on the parts of \sq that we have not described.
Expand All @@ -92,11 +92,11 @@ \section*{The \sq community}
Here is a short list of resources that you may find useful:

\begin{itemize}
\item \url{www.squeak.org} is the main web site of \sq.
\item \url{https://www.squeak.org} is the main web site of \sq.

\item \url{www.squeaksource.com} is the equivalent of GitHub for \sq projects.
\item \url{https://www.squeaksource.com} is the equivalent of GitHub for \sq projects.

\item \url{wiki.squeak.org/squeak} is a wiki with all kinds of information about \sq.
\item \url{https://wiki.squeak.org/squeak} is a wiki with all kinds of information about \sq.

\item The \emphind{help browser} inside \sq gives you access to a lot of useful information.
For example, it contains an overview of \ind{keyboard shortcuts} and documents several packages and tools.
Expand All @@ -118,19 +118,19 @@ \section*{The \sq community}
\paragraph{Group chats.}
Have a question that you need to be answered quickly?
Would you like to meet with other squeakers around the world?
The Slack instance at \url{squeak.slack.com} is a great place to participate in longer-term discussions.
The Slack instance at \url{https://squeak.slack.com} is a great place to participate in longer-term discussions.
Stop by and say ``Hi!''

\paragraph{Other sites.} Several other websites support the \sq community today in various ways.
Here are some of them:
\begin{itemize}
\item \url{github.com/squeak-smalltalk} is the GitHub organization hosting new releases and the various \sq websites.
\item \url{https://github.com/squeak-smalltalk} is the GitHub organization hosting new releases and the various \sq websites.

\item \url{github.com/OpenSmalltalk/opensmalltalk-vm} is the repository of the virtual machine running \sq, the Open\-Smalltalk-VM.
\item \url{https://github.com/OpenSmalltalk/opensmalltalk-vm} is the repository of the virtual machine running \sq, the Open\-Smalltalk-VM.

\item \url{bugs.squeak.org} is the bug tracker where you can report any issues you encounter with the system. You can access debug information through \menu{World docking bar~\go{} Help~\go{} Send Feedback}.
\item \url{https://bugs.squeak.org} is the bug tracker where you can report any issues you encounter with the system. You can access debug information through \menu{World docking bar~\go{} Help~\go{} Send Feedback}.

\item \url{source.squeak.org} hosts the repositories for the base system. If you would like to contribute and want to learn about the community development process, you can learn about it directly in \Squeak under \menu{World docking bar~\go{} Help~\go{} Contributing to Squeak}. You can also learn about the community development process at \url{https://squeak.org/development_process/}.
\item \url{https://source.squeak.org} hosts the repositories for the base system. If you would like to contribute and want to learn about the community development process, you can learn about it directly in \Squeak under \menu{World docking bar~\go{} Help~\go{} Contributing to Squeak}. You can also learn about the community development process at \url{https://squeak.org/development_process/}.

\end{itemize}

Expand All @@ -141,6 +141,7 @@ \section*{Examples and exercises}

We have tried to provide as many examples as possible.
In particular, there are many examples that show a fragment of code that can be evaluated.
\index{print it}
We use the symbol \ct{-->} to indicate the result that you obtain when you select an expression and \menu{print it}:

\begin{code}{@TEST}
Expand Down
Loading

0 comments on commit b3694e3

Please sign in to comment.