Skip to content

Commit b5a9657

Browse files
committed
Improvements to guides
1 parent 7ca3839 commit b5a9657

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

_data/getting-started.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,21 @@
5858
- title: try, catch, and rescue
5959
slug: try-catch-and-rescue
6060

61-
- title: Typespecs and behaviours
62-
slug: typespecs-and-behaviours
63-
6461
- title: Optional syntax sheet
6562
slug: optional-syntax
6663

64+
- title: Erlang libraries
65+
slug: erlang-libraries
66+
6767
- title: Debugging
6868
slug: debugging
6969

70-
- title: Erlang libraries
71-
slug: erlang-libraries
70+
- title: Typespecs and behaviours
71+
slug: typespecs-and-behaviours
7272

7373
- title: Where to go next
7474
slug: where-to-go-next
7575

76-
7776
- title: Mix and OTP
7877
dir: /getting-started/mix-otp/
7978
pages:

getting-started/debugging.markdown

+6-6
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,22 @@ The above will open another Graphical User Interface that provides many panes to
145145

146146
We explore the Observer in the context of an actual project [in the Dynamic Supervisor chapter of the Mix & OTP guide](/getting-started/mix-otp/dynamic-supervisor.html). This is one of the debugging techniques [the Phoenix framework used to achieve 2 million connections on a single machine](https://phoenixframework.org/blog/the-road-to-2-million-websocket-connections).
147147

148+
If you are using the Phoenix web framework, it ships with the [Phoenix LiveDashboard](https://github.com/phoenixframework/phoenix_live_dashboard), a web dashboard for production nodes which provides similar features to Observer.
149+
148150
Finally, remember you can also get a mini-overview of the runtime info by calling `runtime_info/0` directly in IEx.
149151

150152
## Other tools and community
151153

152154
We have just scratched the surface of what the Erlang VM has to offer, for example:
153155

154156
* Alongside the observer application, Erlang also includes a `:crashdump_viewer` to view crash dumps
157+
155158
* Integration with OS level tracers, such as [Linux Trace Toolkit,](http://www.erlang.org/doc/apps/runtime_tools/LTTng.html) [DTRACE,](http://www.erlang.org/doc/apps/runtime_tools/DTRACE.html) and [SystemTap](http://www.erlang.org/doc/apps/runtime_tools/SYSTEMTAP.html)
159+
156160
* [Microstate accounting](http://www.erlang.org/doc/man/msacc.html) measures how much time the runtime spends in several low-level tasks in a short time interval
157-
* Mix ships with many tasks under the `profile` namespace, such as `cprof` and `fprof`
158-
* And more
159161

160-
The community has also created its own tools, often to aid in production, other times in development:
162+
* Mix ships with many tasks under the `profile` namespace, such as `cprof` and `fprof`
161163

162-
* [Phoenix LiveDashboard](https://github.com/phoenixframework/phoenix_live_dashboard) a dashboard for production nodes through a web interface.
163-
* [visualixir](https://github.com/koudelka/visualixir) is a development-time process message visualizer.
164-
* [erlyberly](https://github.com/andytill/erlyberly) is a GUI for tracing during development.
164+
* For more advanced use cases, we recommend the excellent [Erlang in Anger](https://www.erlang-in-anger.com/), which is available as a free ebook
165165

166166
Happy debugging!

getting-started/erlang-libraries.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,5 @@ iex> byte_size compressed
199199
iex> :zlib.uncompress(compressed)
200200
"\nMary had a little lamb,\nHis fleece was white as snow,\nAnd everywhere that Mary went,\nThe lamb was sure to go."
201201
```
202+
203+
Now let's take a look at existing Elixir (and Erlang) libraries you might use while debugging.

getting-started/keywords-and-maps.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ iex> if true, do: "This will be seen", else: "This won't"
220220
"This will be seen"
221221
```
222222

223-
Pay close attention to both syntaxes. In the keyword list format, we separate each key-value pair with commas, and each key is followed by `:`. In the `do`-blocks, we get rid of the commas and separate each keyword by a newline. They are useful exactly because they remove the verbosity when writing blocks of code. Most of the time, you will use the block syntax, but it is good to know they are equivalent.
223+
Pay close attention to both syntaxes. In the keyword list format, we separate each key-value pair with commas, and each key is followed by `:`. In the `do`-blocks, we get rid of the colons, the commas, and separate each keyword by a newline. They are useful exactly because they remove the verbosity when writing blocks of code. Most of the time, you will use the block syntax, but it is good to know they are equivalent.
224224

225225
Note that only a handful of keyword lists can be converted to blocks: `do`, `else`, `catch`, `rescue`, and `after`. Those are all the keywords used by Elixir control-flow constructs. We have already learned some of them and we will learn others in the future.
226226

getting-started/optional-syntax.markdown

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ iex> if true do
2020
...> else
2121
...> :that
2222
...> end
23+
:this
2324

2425
# keyword lists
2526
iex> if true, do: :this, else: :that
2627
:this
2728
```
2829

30+
Keyword lists use Elixir's regular notation for separating arguments, where we separate each key-value pair with commas, and each key is followed by `:`. In the `do`-blocks, we get rid of the colons, the commas, and separate each keyword by a newline. They are useful exactly because they remove the verbosity when writing blocks of code. Most of the time, we use the block syntax, but it is good to know they are equivalent.
31+
2932
Those conveniences, which we call here "optional syntax", allow the language syntax core to be small, without sacrificing the readability and expressiveness of your code. In this brief chapter, we will review the four rules provided by the language, using a short snippet as playground.
3033

3134
## Walk-through
@@ -66,7 +69,7 @@ Now let's remove the conveniences one by one:
6669
if(variable?, [{:do, Call.this()}, {:else, Call.that()}])
6770
```
6871

69-
That's it! Those four rules outline the optional syntax of the code we have written so far. Whenever you have any questions, this quick walk-through has you covered.
72+
That's it! Those four rules outline the optional syntax available in Elixir. Those rules apply everywhere consistently, regardless of the construct you are invoking. Whenever you have any questions, this quick walk-through has you covered.
7073

7174
At the end of the day, those rules are what enables us to write:
7275

0 commit comments

Comments
 (0)