aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/doc/src/shell.xml
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-03-09 10:12:31 +0100
committerHans Bolinder <[email protected]>2017-04-27 10:26:48 +0200
commit6edb6a45d8b2d2993f50176b3324d3fff97fe123 (patch)
tree258d6fe7fd2fde3a56920511e2130fb08ece7a50 /lib/stdlib/doc/src/shell.xml
parent70074be307908d8913e042dcf564487028c53f84 (diff)
downloadotp-6edb6a45d8b2d2993f50176b3324d3fff97fe123.tar.gz
otp-6edb6a45d8b2d2993f50176b3324d3fff97fe123.tar.bz2
otp-6edb6a45d8b2d2993f50176b3324d3fff97fe123.zip
stdlib: Improve the Erlang shell's handling of references
As of Erlang/OTP 20.0, the type of ETS tables, ets:tid(), is a reference(). A request was put forward that the Erlang shell should be able to handle references in its input. This commit introduces an extended parser in module lib. It can parse pids, ports, references, and external funs under the condition that they can be created in the running system. The parser is meant to be used internally in Erlang/OTP. The alternative, to extend erl_scan and erl_parse, was deemed inferior as it would require the abstract format be able to represent pids, ports, references, and funs, which would be confusing as they are not expressions as such, but data types.
Diffstat (limited to 'lib/stdlib/doc/src/shell.xml')
-rw-r--r--lib/stdlib/doc/src/shell.xml21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/stdlib/doc/src/shell.xml b/lib/stdlib/doc/src/shell.xml
index ab62c2fcdd..2593d3690b 100644
--- a/lib/stdlib/doc/src/shell.xml
+++ b/lib/stdlib/doc/src/shell.xml
@@ -569,7 +569,7 @@ Hello Number: 3378
<pre>
42> <input>E = ets:new(t, []).</input>
-17</pre>
+#Ref&lt;0.1662103692.2407923716.214192></pre>
<p>Command 42 creates an ETS table.</p>
@@ -602,7 +602,7 @@ false</pre>
<pre>
47> <input>E = ets:new(t, []).</input>
-18
+#Ref&lt;0.1662103692.2407923716.214197>
48> <input>ets:insert({d,1,2}).</input>
* exception error: undefined function ets:insert/1</pre>
@@ -617,10 +617,23 @@ true</pre>
<p>Command 49 successfully inserts the tuple into the ETS table.</p>
<pre>
-50> <input>halt().</input>
+50> <input>ets:insert(#Ref&lt;0.1662103692.2407923716.214197>, {e,3,4}).</input>
+true</pre>
+
+ <p>Command 50 inserts another tuple into the ETS table. This time
+ the first argument is the table identifier itself. The shell can
+ parse commands with pids (<c>&lt;0.60.0></c>), ports
+ (<c>#Port&lt;0.536></c>), references
+ (<c>#Ref&lt;0.1662103692.2407792644.214210></c>), and external
+ functions (<c>#Fun&lt;a.b.1></c>), but the command fails unless
+ the corresponding pid, port, reference, or function can be created
+ in the running system.</p>
+
+ <pre>
+51> <input>halt().</input>
strider 2></pre>
- <p>Command 50 exits the Erlang runtime system.</p>
+ <p>Command 51 exits the Erlang runtime system.</p>
</section>
<section>