@@ -182,15 +182,14 @@ The [`Number`](@ref) type is a direct child type of `Any`, and [`Real`](@ref) is
182182In turn, ` Real ` has two children (it has more, but only two are shown here; we'll get to
183183the others later): [ ` Integer ` ] ( @ref ) and [ ` AbstractFloat ` ] ( @ref ) , separating the world into
184184representations of integers and representations of real numbers. Representations of real
185- numbers include, of course, floating-point types, but also include other types, such as
186- rationals. Hence, ` AbstractFloat ` is a proper subtype of ` Real ` , including only
187- floating-point representations of real numbers. Integers are further subdivided into
188- [ ` Signed ` ] ( @ref ) and [ ` Unsigned ` ] ( @ref ) varieties.
185+ numbers include floating-point types, but also include other types, such as rationals.
186+ ` AbstractFloat ` includes only floating-point representations of real numbers. Integers
187+ are further subdivided into [ ` Signed ` ] ( @ref ) and [ ` Unsigned ` ] ( @ref ) varieties.
189188
190- The ` <: ` operator in general means "is a subtype of", and, used in declarations like this, declares
191- the right-hand type to be an immediate supertype of the newly declared type. It can also be used
192- in expressions as a subtype operator which returns ` true ` when its left operand is a subtype of
193- its right operand:
189+ The ` <: ` operator in general means "is a subtype of", and, used in declarations like those above,
190+ declares the right-hand type to be an immediate supertype of the newly declared type. It can also
191+ be used in expressions as a subtype operator which returns ` true ` when its left operand is a
192+ subtype of its right operand:
194193
195194``` jldoctest
196195julia> Integer <: Number
@@ -1124,16 +1123,16 @@ Parametric types can be singleton types when the above condition holds. For exam
11241123julia> struct NoFieldsParam{T}
11251124 end
11261125
1127- julia> Base.issingletontype(NoFieldsParam) # can 't be a singleton type ...
1126+ julia> Base.issingletontype(NoFieldsParam) # Can 't be a singleton type ...
11281127false
11291128
11301129julia> NoFieldsParam{Int}() isa NoFieldsParam # ... because it has ...
11311130true
11321131
1133- julia> NoFieldsParam{Bool}() isa NoFieldsParam # ... multiple instances
1132+ julia> NoFieldsParam{Bool}() isa NoFieldsParam # ... multiple instances.
11341133true
11351134
1136- julia> Base.issingletontype(NoFieldsParam{Int}) # parametrized , it is a singleton
1135+ julia> Base.issingletontype(NoFieldsParam{Int}) # Parametrized , it is a singleton.
11371136true
11381137
11391138julia> NoFieldsParam{Int}() === NoFieldsParam{Int}()
@@ -1177,11 +1176,14 @@ Types of closures are not necessarily singletons.
11771176julia> addy(y) = x -> x + y
11781177addy (generic function with 1 method)
11791178
1180- julia> Base.issingletontype (addy(1))
1181- false
1179+ julia> typeof (addy(1)) === typeof(addy(2 ))
1180+ true
11821181
11831182julia> addy(1) === addy(2)
11841183false
1184+
1185+ julia> Base.issingletontype(typeof(addy(1)))
1186+ false
11851187```
11861188
11871189## [ ` Type{T} ` type selectors] (@id man-typet-type)
@@ -1553,8 +1555,8 @@ floating-point numbers, tuples, etc.) as type parameters. A common example is t
15531555parameter in ` Array{T,N} ` , where ` T ` is a type (e.g., [ ` Float64 ` ] ( @ref ) ) but ` N ` is just an ` Int ` .
15541556
15551557You can create your own custom types that take values as parameters, and use them to control dispatch
1556- of custom types. By way of illustration of this idea, let's introduce a parametric type, ` Val{x} ` ,
1557- and a constructor ` Val(x) = Val{x}() ` , which serves as a customary way to exploit this technique
1558+ of custom types. By way of illustration of this idea, let's introduce the parametric type ` Val{x} ` ,
1559+ and its constructor ` Val(x) = Val{x}() ` , which serves as a customary way to exploit this technique
15581560for cases where you don't need a more elaborate hierarchy.
15591561
15601562[ ` Val ` ] ( @ref ) is defined as:
0 commit comments