You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: General/Playground.md
+22-22
Original file line number
Diff line number
Diff line change
@@ -19,46 +19,46 @@
19
19
*[Sharing playgrounds content in multiple local images](#sharing-playgrounds-content-in-multiple-local-images)
20
20
21
21
22
-
Playground is a tool that is most often used for typing Pharo expressions and executing them but it can be used as a scratchpad area where fragments of Pharo code can be entered, stored, edited, and evaluated.
22
+
Playground is a tool that is most often used for typing Pharo expressions and executing them but it can be used as a scratchpad area where fragments of Pharo code can be entered, stored, edited and evaluated.
23
23
24
-
You can open it with the shortcut `cmd/ctrl + o + w` or using the menu entry from the menubar:
24
+
You can open Playground with the shortcut `cmd/ctrl + o + w` or using the menu entry from the menubar:
25
25
26
26

27
27
28
28
## Basic usage
29
-
The Playground can be used to quickly execute Pharo code. You write something and then can do operations on the code, such as:
29
+
The Playground can be used to quickly execute Pharo code. You can write something and then do operations on the code, such as:
30
30
31
31
### Do it
32
32
Shortcut: `cmd/ctrl + d` It Executes the code/expression
33
33
34
34

35
35
36
36
### Print it
37
-
Shortcut: `cmd/ctrl + p` It Compiles the expression, executes it, sends the message `printString` to the result, and displays the resulting string.
37
+
Shortcut: `cmd/ctrl + p` It Compiles the expression, executes it, sends the message `printString` to the result and displays the resulting string.
38
38
39
39

40
40

41
41
42
42
### Do it and go
43
-
Shortcut: `cmd/ctrl + g` It executes the code and additionally opens a navigable inspector on the side of the playground. It allows us to navigate the object structure.
43
+
Shortcut: `cmd/ctrl + g` It executes the code and opens a navigable inspector on the side of the playground. It allows us to browse the object structure.
44
44
45
45

46
46
47
47
### Inspect it
48
-
Shortcut: `cmd/ctrl + i` It executes the code and additionally opens a navigable inspector outside of the playground. It allows us to navigate the object structure.
48
+
Shortcut: `cmd/ctrl + i` It executes the code and opens a navigable inspector outside of the playground. It allows us to browse the object structure.
49
49
50
50

51
51
52
52
> The title tells us that `11:55:11.561177 am` is an instance of the class `Time`. The top panel allows us to browse the instance variables of an object and their values. The bottom panel can be used to write expressions to send messages to the object.
53
53
54
54
### Basic inspect it
55
-
Shortcut: `cmd/ctrl + shift + i` It opens a minimal inspector on the result of the expression. (Might be useful if you work on the Inspector for example)
55
+
Shortcut: `cmd/ctrl + shift + i` It opens a minimal inspector on the result of the expression. (Might be useful if you work on the Inspector, for example)
56
56
### Debug it
57
57
Shortcut: `cmd/ctrl + shift + d` It opens a debugger on the code with the context at the start of the snippet.
58
58
59
59

60
60
61
-
>The Debugger is a tool that not only lets you inspect the run-time stack of your program when an error is raised, but it also enables you to interact with all of the objects of your application, including the source code. In many cases you can modify your source code from the debugger and continue executing. The debugger is especially effective as a tool to support test-first development in tandem with SUnit.
61
+
>The Debugger is a tool that not only lets you inspect the run-time stack of your program when an error is raised, but it also enables you to interact with all of the objects in your application, including the source code. In many cases you can modify your source code from the debugger and continue executing. The debugger is especially effective as a tool to support test-first development in tandem with SUnit.
62
62
63
63
### Profile it
64
64
Profiles the code with the Pharo profile tool which shows how much time is spent for each message sent.
@@ -71,21 +71,21 @@ You can also use the playground for typing any text that you would like to remem
71
71
72
72
## Some Advices
73
73
### Doing vs. Printing
74
-
The diference between this two actions is visual. try to execute something like `1+5` with `Do it`. Maybe you think that nothing happened because there isn't a visual cue about the execution but in fact something did happen. You sent the message `+` with argument `5` to the number `1`.
74
+
The difference between these two actions is visual. try to execute something like `1+5` with `Do it`. Maybe you think that nothing happened because there isn't a visual cue about the execution but in fact, something did happen. You sent the message `+` with argument `5` to the number `1`.
75
75
76
-
Now try to do it with Print it, the same will happen but also you will see the result printed just aside:
76
+
Now try to do it with Print it, the same will happen but you will now see the result printed on the side:
77
77
78
78

79
79
80
80
That could be useful if you want to understand the result value.
81
81
82
82
## Advance usage
83
83
84
-
In this section, we will cover some advance usages of the Playground.
84
+
In this section, we will cover some advanced usages of the Playground.
85
85
86
86

87
87
88
-
The previous figure highlight different parts of the playground we will refer to in this explanation.
88
+
The previous figure highlights different parts of the playground and we will refer to these in this explanation.
89
89
90
90
1. The playground name tab
91
91
2. The run button
@@ -97,7 +97,7 @@ Out of those, the simplest feature is the run button that will just execute the
97
97
98
98
### Variables bindings
99
99
100
-
The playground is able to manage variables in two way. The first way is the classic Smalltalk way of declaring temporary variables (`| varName |`) at the beginning of the playground and using them later.
100
+
The playground is able to manage variables in two ways. The first way is the classic Smalltalk way of declaring temporary variables (`| varName |`) at the beginning of the playground and using them later.
101
101
102
102
Example:
103
103
@@ -107,9 +107,9 @@ result := 1 + 2.
107
107
result := result + 3.
108
108
```
109
109
110
-
Using this kind of variables will work as the temporary variables of methods. During the execution they will be initialized at nil, they will be used during the current execution and then they will be discarded.
110
+
Using these kind of variables will work as temporary variables of methods. During the execution they will be initialized with nil. They will be used during the current execution and then they will be discarded.
111
111
112
-
> Note: If you select a piece of code to execute it, do not forget to select the temporary variables declaration line.
112
+
> Note: If you select a piece of code to execute, do not forget to select the temporary variables declaration line.
113
113
114
114
The second way to manage variables in the playground is to use them without declaring them.
115
115
@@ -120,11 +120,11 @@ result := 1 + 2.
120
120
result := result + 3
121
121
```
122
122
123
-
By doing so, during its first use, the playground creates and initialize the new variable to nil and stores it. This means that the variable will still exist and will still contain its value after the execution. If you execute the previous piece of code in a playground and then select `result` to inspect it, you will find the value `6`.
123
+
By doing so, during its first use, the playground creates and initializes the new variable to nil, then stores it. This means that the variable will still exist and will still contain its value after the execution. If you execute the previous piece of code in a playground and then select `result` to inspect it, you will find the value `6`.
124
124
125
-
This feature is useful while playing with some code. For example, if you need to work on a model, instead of recreating the model at each run you can just initialize it one time and reuse the variable containing the model for all the playground session.
125
+
This feature is useful while playing with some code. For example, if you need to work on a model, instead of recreating the model at each run you can just initialize it one time and reuse the variable containing the model for the entire playground session.
126
126
127
-
If at some point you don't remember the content of some variables, you can find all the variables the playground bound in the binding table button (4 on the previous overview screenshot). This table also allows you to unbind variables by clicking on the cross next to their name.
127
+
If at some point you don't remember the content of some variables, you can find all the variables bound to the playground in the binding table button (4 on the previous overview screenshot). This table also allows you to unbind variables by clicking on the cross next to their name.
128
128
129
129
### Remote publishing
130
130
@@ -136,9 +136,9 @@ You can then share this link and everyone with it will be able to see the conten
136
136
137
137
### Get back previous playground contents
138
138
139
-
When working the playground will once in a while save the code of your playground in a local file. Using those saved files you have the possibility to open a new playground containing the code of a previously closed playground.
139
+
Whilst working, the playground will occasionally save the code in a local file. Using those saved files you have the ability to open a new playground containing the code of a previously closed playground.
140
140
141
-
In order to get back a previous playground, you need to open a new playground and use button 5 from the overview, the *page history button*. You will see the start of the code from your previous playgrounds and you need to double click on the one you want to get back.
141
+
In order to get a previous playground back, you need to open a new playground and use button 5 from the overview, the *page history button*. You will see the start of the code from your previous playgrounds and you need to double click on the one you want to get it back.
142
142
143
143
### Give a name to a playground to get it back
144
144
@@ -152,7 +152,7 @@ If you close the playground and want to get it back, you can open a `Spotter` (`
152
152
153
153
One last feature to highlight is the ability to share playground code between multiple local Pharo images.
154
154
155
-
We have seen in the previous sections that it is possible to get back the content of the previous playgrounds via the `page history button` and the ability of the Spotter to find previous named playground pages. By updating some settings of the playground, it is possible to share that history through all your images.
155
+
We have seen in the previous sections that it is possible to get back the content of the previous playgrounds via the `page history button` and the ability of the Spotter to find named playground pages. By updating some settings of the playground, it is possible to share that history through all your images.
156
156
157
157
As explained before, when using the playground and naming playgrounds, the content is stored in local files. In order to share the playgrounds through different images, they need to use the same folders to store their content. Two settings are available for that and can be found in the setting browser under `Tools` -> `Glamourous Toolkit`.
158
158
@@ -163,4 +163,4 @@ The two interesting settings are:
163
163
-`Local Playground cache directory`: this setting allows one to choose a specific folder to store the unnamed playground contents.
164
164
-`Local Playground stash directory`: this setting allows one to choose a specific folder to store the named playground contents.
165
165
166
-
Sharing this setting with multiple images will allow one to share playgrounds history through all those images.
166
+
Sharing this setting with multiple images will allow one to share playground history across all those images.
0 commit comments