Skip to content

Commit 1135a72

Browse files
authored
fix #28647, add doc string for Symbol (#30747)
1 parent 6919ddf commit 1135a72

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

base/docs/basedocs.jl

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,10 +1290,41 @@ for bit in (8, 16, 32, 64, 128)
12901290
end
12911291
end
12921292

1293+
"""
1294+
Symbol
1295+
1296+
The type of object used to represent identifiers in parsed julia code (ASTs).
1297+
Also often used as a name or label to identify an entity (e.g. as a dictionary key).
1298+
`Symbol`s can be entered using the `:` quote operator:
1299+
```jldoctest
1300+
julia> :name
1301+
:name
1302+
1303+
julia> typeof(:name)
1304+
Symbol
1305+
1306+
julia> x = 42
1307+
42
1308+
1309+
julia> eval(:x)
1310+
42
1311+
```
1312+
`Symbol`s can also be constructed from strings or other values by calling the
1313+
constructor `Symbol(x...)`.
1314+
1315+
`Symbol`s are immutable and should be compared using `===`.
1316+
The implementation re-uses the same object for all `Symbol`s with the same name,
1317+
so comparison tends to be efficient (it can just compare pointers).
1318+
1319+
Unlike strings, `Symbol`s are "atomic" or "scalar" entities that do not support
1320+
iteration over characters.
1321+
"""
1322+
Symbol
1323+
12931324
"""
12941325
Symbol(x...) -> Symbol
12951326
1296-
Create a `Symbol` by concatenating the string representations of the arguments together.
1327+
Create a [`Symbol`](@ref) by concatenating the string representations of the arguments together.
12971328
12981329
# Examples
12991330
```jldoctest
@@ -1304,7 +1335,7 @@ julia> Symbol("day", 4)
13041335
:day4
13051336
```
13061337
"""
1307-
Symbol
1338+
Symbol(x...)
13081339

13091340
"""
13101341
tuple(xs...)

0 commit comments

Comments
 (0)