## [Special Types](#Special-Types)
```julia-repl
julia> (; :a => 1, :b => 2, c=3)
(a = 1, b = 2, c = 3)
```
The name-value pairs can also be provided by splatting a named tuple or any iterator that yields two-value collections holding each a symbol as first value:
```julia-repl
julia> keys = (:a, :b, :c); values = (1, 2, 3);

julia> NamedTuple{keys}(values)
(a = 1, b = 2, c = 3)

julia> (; (keys .=> values)...)
(a = 1, b = 2, c = 3)

julia> nt1 = (a=1, b=2);

julia> nt2 = (c=3, d=4);

julia> (; nt1..., nt2..., b=20) # the final b overwrites the value from nt1
(a = 1, b = 20, c = 3, d = 4)

julia> (; zip(keys, values)...) # zip yields tuples such as (:a, 1)
(a = 1, b = 2, c = 3)
```
As in keyword arguments, identifiers and dot expressions imply names:
```julia-repl
julia> x = 0
0

julia> t = (; x)
(x = 0,)

julia> (; t.x)
(x = 0,)
```
Implicit names from identifiers and dot expressions are available as of Julia 1.5.
Use of `getindex` methods with multiple `Symbol`s is available as of Julia 1.7.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/namedtuple.jl#L3-L110)
```julia
@NamedTuple{key1::Type1, key2::Type2, ...}
@NamedTuple begin key1::Type1; key2::Type2; ...; end
```


## [Special Types](#Special-Types)
This macro gives a more convenient syntax for declaring `NamedTuple` types. It returns a `NamedTuple` type with the given keys and types, equivalent to `NamedTuple{(:key1, :key2, ...), Tuple{Type1,Type2,...}}`. If the `::Type` declaration is omitted, it is taken to be `Any`. The `begin ... end` form allows the declarations to be split across multiple lines (similar to a `struct` declaration), but is otherwise equivalent. The `NamedTuple` macro is used when printing `NamedTuple` types to e.g. the REPL.
For example, the tuple `(a=3.1, b="hello")` has a type `NamedTuple{(:a, :b), Tuple{Float64, String}}`, which can also be declared via `@NamedTuple` as:
```julia-repl
julia> @NamedTuple{a::Float64, b::String}
@NamedTuple{a::Float64, b::String}

julia> @NamedTuple begin
           a::Float64
           b::String
       end
@NamedTuple{a::Float64, b::String}
```
This macro is available as of Julia 1.5.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/namedtuple.jl#L472-L498)
```julia
@Kwargs{key1::Type1, key2::Type2, ...}
```


## [Special Types](#Special-Types)
This macro gives a convenient way to construct the type representation of keyword arguments from the same syntax as [`@NamedTuple`](#Base.@NamedTuple). For example, when we have a function call like `func([positional arguments]; kw1=1.0, kw2="2")`, we can use this macro to construct the internal type representation of the keyword arguments as `@Kwargs{kw1::Float64, kw2::String}`. The macro syntax is specifically designed to simplify the signature type of a keyword method when it is printed in the stack trace view.
```julia
julia> @Kwargs{init::Int} # the internal representation of keyword arguments
Base.Pairs{Symbol, Int64, Tuple{Symbol}, @NamedTuple{init::Int64}}

julia> sum("julia"; init=1)
ERROR: MethodError: no method matching +(::Char, ::Char)
The function `+` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  +(::Any, ::Any, ::Any, ::Any...)
   @ Base operators.jl:585
  +(::Integer, ::AbstractChar)
   @ Base char.jl:247
  +(::T, ::Integer) where T<:AbstractChar
   @ Base char.jl:237

Stacktrace:
  [1] add_sum(x::Char, y::Char)
    @ Base ./reduce.jl:24
  [2] BottomRF
    @ Base ./reduce.jl:86 [inlined]
  [3] _foldl_impl(op::Base.BottomRF{typeof(Base.add_sum)}, init::Int64, itr::String)
    @ Base ./reduce.jl:62
  [4] foldl_impl(op::Base.BottomRF{typeof(Base.add_sum)}, nt::Int64, itr::String)
    @ Base ./reduce.jl:48 [inlined]
  [5] mapfoldl_impl(f::typeof(identity), op::typeof(Base.add_sum), nt::Int64, itr::String)
    @ Base ./reduce.jl:44 [inlined]
  [6] mapfoldl(f::typeof(identity), op::typeof(Base.add_sum), itr::String; init::Int64)
    @ Base ./reduce.jl:175 [inlined]
  [7] mapreduce(f::typeof(identity), op::typeof(Base.add_sum), itr::String; kw::@Kwargs{init::Int64})
    @ Base ./reduce.jl:307 [inlined]
  [8] sum(f::typeof(identity), a::String; kw::@Kwargs{init::Int64})
    @ Base ./reduce.jl:535 [inlined]
  [9] sum(a::String; kw::@Kwargs{init::Int64})
    @ Base ./reduce.jl:564 [inlined]
 [10] top-level scope
    @ REPL[12]:1
```


## [Special Types](#Special-Types)
This macro is available as of Julia 1.10.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/namedtuple.jl#L510-L562)
```julia
Val(c)
```
Return `Val{c}()`, which contains no run-time data. Types like this can be used to pass the information between functions through the value `c`, which must be an `isbits` value or a `Symbol`. The intent of this construct is to be able to dispatch on constants directly (at compile time) without having to test the value of the constant at run time.
**Examples**
```julia-repl
julia> f(::Val{true}) = "Good"
f (generic function with 1 method)

julia> f(::Val{false}) = "Bad"
f (generic function with 2 methods)

julia> f(Val(true))
"Good"
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1014-L1033)
```julia
Vararg{T,N}
```
The last parameter of a tuple type [`Tuple`](#Core.Tuple) can be the special value `Vararg`, which denotes any number of trailing elements. `Vararg{T,N}` corresponds to exactly `N` elements of type `T`. Finally `Vararg{T}` corresponds to zero or more elements of type `T`. `Vararg` tuple types are used to represent the arguments accepted by varargs methods (see the section on [Varargs Functions](../../manual/functions/#Varargs-Functions) in the manual.)
See also [`NTuple`](#Core.NTuple).
**Examples**


## [Special Types](#Special-Types)
```julia-repl
julia> mytupletype = Tuple{AbstractString, Vararg{Int}}
Tuple{AbstractString, Vararg{Int64}}

julia> isa(("1",), mytupletype)
true

julia> isa(("1",1), mytupletype)
true

julia> isa(("1",1,2), mytupletype)
true

julia> isa(("1",1,2,3.0), mytupletype)
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3245-L3272)
```julia
Nothing
```
A type with no fields that is the type of [`nothing`](../constants/#Core.nothing).
See also: [`isnothing`](#Base.isnothing), [`Some`](#Base.Some), [`Missing`](#Base.Missing).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1533-L1539)
```julia
isnothing(x)
```
Return `true` if `x === nothing`, and return `false` if not.
This function requires at least Julia 1.1.
See also [`something`](#Base.something), [`Base.notnothing`](#Base.notnothing), [`ismissing`](#Base.ismissing).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/some.jl#L59-L68)
```julia
notnothing(x)
```
Throw an error if `x === nothing`, and return `x` if not.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/some.jl#L51-L55)
```julia
Some{T}
```
A wrapper type used in `Union{Some{T}, Nothing}` to distinguish between the absence of a value ([`nothing`](../constants/#Core.nothing)) and the presence of a `nothing` value (i.e. `Some(nothing)`).


## [Special Types](#Special-Types)
Use [`something`](#Base.something) to access the value wrapped by a `Some` object.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/some.jl#L3-L10)
```julia
something(x...)
```
Return the first value in the arguments which is not equal to [`nothing`](../constants/#Core.nothing), if any. Otherwise throw an error. Arguments of type [`Some`](#Base.Some) are unwrapped.
See also [`coalesce`](#Base.coalesce), [`skipmissing`](#Base.skipmissing), [`@something`](#Base.@something).
**Examples**
```julia-repl
julia> something(nothing, 1)
1

julia> something(Some(1), nothing)
1

julia> something(Some(nothing), 2) === nothing
true

julia> something(missing, nothing)
missing

julia> something(nothing, nothing)
ERROR: ArgumentError: No value arguments present
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/some.jl#L72-L98)
```julia
@something(x...)
```
Short-circuiting version of [`something`](#Base.something).
**Examples**
```julia-repl
julia> f(x) = (println("f($x)"); nothing);

julia> a = 1;

julia> a = @something a f(2) f(3) error("Unable to find default for `a`")
1

julia> b = nothing;

julia> b = @something b f(2) f(3) error("Unable to find default for `b`")
f(2)
f(3)
ERROR: Unable to find default for `b`
[...]

julia> b = @something b f(2) f(3) Some(nothing)
f(2)
f(3)

julia> b === nothing
true
```
This macro is available as of Julia 1.7.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/some.jl#L107-L139)


## [Special Types](#Special-Types)
```julia
Enum{T<:Integer}
```
The abstract supertype of all enumerated types defined with [`@enum`](#Base.Enums.@enum).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/Enums.jl#L10-L14)
```julia
@enum EnumName[::BaseType] value1[=x] value2[=y]
```
Create an `Enum{BaseType}` subtype with name `EnumName` and enum member values of `value1` and `value2` with optional assigned values of `x` and `y`, respectively. `EnumName` can be used just like other types and enum member values as regular values, such as
**Examples**
```julia-repl
julia> @enum Fruit apple=1 orange=2 kiwi=3

julia> f(x::Fruit) = "I'm a Fruit with value: $(Int(x))"
f (generic function with 1 method)

julia> f(apple)
"I'm a Fruit with value: 1"

julia> Fruit(1)
apple::Fruit = 1
```
Values can also be specified inside a `begin` block, e.g.
```julia
@enum EnumName begin
    value1
    value2
end
```
`BaseType`, which defaults to [`Int32`](../numbers/#Core.Int32), must be a primitive subtype of `Integer`. Member values can be converted between the enum type and `BaseType`. `read` and `write` perform these conversions automatically. In case the enum is created with a non-default `BaseType`, `Integer(value1)` will return the integer `value1` with the type `BaseType`.
To list all the instances of an enum use `instances`, e.g.
```julia-repl
julia> instances(Fruit)
(apple, orange, kiwi)
```
It is possible to construct a symbol from an enum instance:
```julia-repl
julia> Symbol(apple)
:apple
```


## [Special Types](#Special-Types)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/Enums.jl#L95-L143)
```julia
Expr(head::Symbol, args...)
```
A type representing compound expressions in parsed julia code (ASTs). Each expression consists of a `head` `Symbol` identifying which kind of expression it is (e.g. a call, for loop, conditional statement, etc.), and subexpressions (e.g. the arguments of a call). The subexpressions are stored in a `Vector{Any}` field called `args`.
See the manual chapter on [Metaprogramming](../../manual/metaprogramming/#Metaprogramming) and the developer documentation [Julia ASTs](../../devdocs/ast/#Julia-ASTs).
**Examples**
```julia-repl
julia> Expr(:call, :+, 1, 2)
:(1 + 2)

julia> dump(:(a ? b : c))
Expr
  head: Symbol if
  args: Array{Any}((3,))
    1: Symbol a
    2: Symbol b
    3: Symbol c
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L704-L729)
```julia
Symbol
```
The type of object used to represent identifiers in parsed julia code (ASTs). Also often used as a name or label to identify an entity (e.g. as a dictionary key). `Symbol`s can be entered using the `:` quote operator:
```julia-repl
julia> :name
:name

julia> typeof(:name)
Symbol

julia> x = 42
42

julia> eval(:x)
42
```
`Symbol`s can also be constructed from strings or other values by calling the constructor `Symbol(x...)`.
`Symbol`s are immutable and their implementation re-uses the same object for all `Symbol`s with the same name.


## [Special Types](#Special-Types)
Unlike strings, `Symbol`s are "atomic" or "scalar" entities that do not support iteration over characters.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2254-L2281)
```julia
Symbol(x...) -> Symbol
```
Create a [`Symbol`](#Core.Symbol) by concatenating the string representations of the arguments together.
**Examples**
```julia-repl
julia> Symbol("my", "name")
:myname

julia> Symbol("day", 4)
:day4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2284-L2297)
```julia
Module
```
A `Module` is a separate global variable workspace. See [`module`](#module) and the [manual section about modules](../../manual/modules/#modules) for details.
```julia
Module(name::Symbol=:anonymous, std_imports=true, default_names=true)
```
Return a module with the specified name. A `baremodule` corresponds to `Module(:ModuleName, false)`
An empty module containing no names at all can be created with `Module(:ModuleName, false, false)`. This module will not import `Base` or `Core` and does not contain a reference to itself.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3525-L3536)


## [Generic Functions](#Generic-Functions)
```julia
Function
```
Abstract type of all functions.
**Examples**
```julia-repl
julia> isa(+, Function)
true

julia> typeof(sin)
typeof(sin) (singleton type of function sin, subtype of Function)

julia> ans <: Function
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1609-L1625)
```julia
hasmethod(f, t::Type{<:Tuple}[, kwnames]; world=get_world_counter()) -> Bool
```
Determine whether the given generic function has a method matching the given `Tuple` of argument types with the upper bound of world age given by `world`.
If a tuple of keyword argument names `kwnames` is provided, this also checks whether the method of `f` matching `t` has the given keyword argument names. If the matching method accepts a variable number of keyword arguments, e.g. with `kwargs...`, any names given in `kwnames` are considered valid. Otherwise the provided names must be a subset of the method's keyword arguments.
See also [`applicable`](#Core.applicable).
Providing keyword argument names requires Julia 1.2 or later.
**Examples**
```julia-repl
julia> hasmethod(length, Tuple{Array})
true

julia> f(; oranges=0) = oranges;

julia> hasmethod(f, Tuple{}, (:oranges,))
true

julia> hasmethod(f, Tuple{}, (:apples, :bananas))
false

julia> g(; xs...) = 4;

julia> hasmethod(g, Tuple{}, (:a, :b, :c, :d))  # g accepts arbitrary kwargs
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2310-L2345)


## [Generic Functions](#Generic-Functions)
```julia
applicable(f, args...) -> Bool
```
Determine whether the given generic function has a method applicable to the given arguments.
See also [`hasmethod`](#Base.hasmethod).
**Examples**
```julia-repl
julia> function f(x, y)
           x + y
       end;

julia> applicable(f, 1)
false

julia> applicable(f, 1, 2)
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1921-L1940)
```julia
Base.isambiguous(m1, m2; ambiguous_bottom=false) -> Bool
```
Determine whether two methods `m1` and `m2` may be ambiguous for some call signature. This test is performed in the context of other methods of the same function; in isolation, `m1` and `m2` might be ambiguous, but if a third method resolving the ambiguity has been defined, this returns `false`. Alternatively, in isolation `m1` and `m2` might be ordered, but if a third method cannot be sorted with them, they may cause an ambiguity together.
For parametric types, the `ambiguous_bottom` keyword argument controls whether `Union{}` counts as an ambiguous intersection of type parameters – when `true`, it is considered ambiguous, when `false` it is not.
**Examples**


## [Generic Functions](#Generic-Functions)
```julia-repl
julia> foo(x::Complex{<:Integer}) = 1
foo (generic function with 1 method)

julia> foo(x::Complex{<:Rational}) = 2
foo (generic function with 2 methods)

julia> m1, m2 = collect(methods(foo));

julia> typeintersect(m1.sig, m2.sig)
Tuple{typeof(foo), Complex{Union{}}}

julia> Base.isambiguous(m1, m2, ambiguous_bottom=true)
true

julia> Base.isambiguous(m1, m2, ambiguous_bottom=false)
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2421-L2454)
```julia
invoke(f, argtypes::Type, args...; kwargs...)
```
Invoke a method for the given generic function `f` matching the specified types `argtypes` on the specified arguments `args` and passing the keyword arguments `kwargs`. The arguments `args` must conform with the specified types in `argtypes`, i.e. conversion is not automatically performed. This method allows invoking a method other than the most specific matching method, which is useful when the behavior of a more general definition is explicitly needed (often as part of the implementation of a more specific method of the same function).


## [Generic Functions](#Generic-Functions)
Be careful when using `invoke` for functions that you don't write. What definition is used for given `argtypes` is an implementation detail unless the function is explicitly states that calling with certain `argtypes` is a part of public API. For example, the change between `f1` and `f2` in the example below is usually considered compatible because the change is invisible by the caller with a normal (non-`invoke`) call. However, the change is visible if you use `invoke`.
**Examples**
```julia-repl
julia> f(x::Real) = x^2;

julia> f(x::Integer) = 1 + invoke(f, Tuple{Real}, x);

julia> f(2)
5

julia> f1(::Integer) = Integer
       f1(::Real) = Real;

julia> f2(x::Real) = _f2(x)
       _f2(::Integer) = Integer
       _f2(_) = Real;

julia> f1(1)
Integer

julia> f2(1)
Integer

julia> invoke(f1, Tuple{Real}, 1)
Real

julia> invoke(f2, Tuple{Real}, 1)
Integer
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1943-L1988)
```julia
@invoke f(arg::T, ...; kwargs...)
```
Provides a convenient way to call [`invoke`](#Core.invoke) by expanding `@invoke f(arg1::T1, arg2::T2; kwargs...)` to `invoke(f, Tuple{T1,T2}, arg1, arg2; kwargs...)`. When an argument's type annotation is omitted, it's replaced with `Core.Typeof` that argument. To invoke a method where an argument is untyped or explicitly typed as `Any`, annotate the argument with `::Any`.
It also supports the following syntax:
-   `@invoke (x::X).f` expands to `invoke(getproperty, Tuple{X,Symbol}, x, :f)`


## [Generic Functions](#Generic-Functions)
-   `@invoke (x::X).f = v::V` expands to `invoke(setproperty!, Tuple{X,Symbol,V}, x, :f, v)`
-   `@invoke (xs::Xs)[i::I]` expands to `invoke(getindex, Tuple{Xs,I}, xs, i)`
-   `@invoke (xs::Xs)[i::I] = v::V` expands to `invoke(setindex!, Tuple{Xs,V,I}, xs, v, i)`
**Examples**
```julia-repl
julia> @macroexpand @invoke f(x::T, y)
:(Core.invoke(f, Tuple{T, Core.Typeof(y)}, x, y))

julia> @invoke 420::Integer % Unsigned
0x00000000000001a4

julia> @macroexpand @invoke (x::X).f
:(Core.invoke(Base.getproperty, Tuple{X, Core.Typeof(:f)}, x, :f))

julia> @macroexpand @invoke (x::X).f = v::V
:(Core.invoke(Base.setproperty!, Tuple{X, Core.Typeof(:f), V}, x, :f, v))

julia> @macroexpand @invoke (xs::Xs)[i::I]
:(Core.invoke(Base.getindex, Tuple{Xs, I}, xs, i))

julia> @macroexpand @invoke (xs::Xs)[i::I] = v::V
:(Core.invoke(Base.setindex!, Tuple{Xs, V, I}, xs, v, i))
```
This macro requires Julia 1.7 or later.
This macro is exported as of Julia 1.9.
The additional syntax is supported as of Julia 1.10.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2627-L2672)
```julia
invokelatest(f, args...; kwargs...)
```


## [Generic Functions](#Generic-Functions)
Calls `f(args...; kwargs...)`, but guarantees that the most recent method of `f` will be executed. This is useful in specialized circumstances, e.g. long-running event loops or callback functions that may call obsolete versions of a function `f`. (The drawback is that `invokelatest` is somewhat slower than calling `f` directly, and the type of the result cannot be inferred by the compiler.)
Prior to Julia 1.9, this function was not exported, and was called as `Base.invokelatest`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1039-L1051)
```julia
@invokelatest f(args...; kwargs...)
```
Provides a convenient way to call [`invokelatest`](#Base.invokelatest). `@invokelatest f(args...; kwargs...)` will simply be expanded into `Base.invokelatest(f, args...; kwargs...)`.
It also supports the following syntax:
-   `@invokelatest x.f` expands to `Base.invokelatest(getproperty, x, :f)`
-   `@invokelatest x.f = v` expands to `Base.invokelatest(setproperty!, x, :f, v)`
-   `@invokelatest xs[i]` expands to `Base.invokelatest(getindex, xs, i)`
-   `@invokelatest xs[i] = v` expands to `Base.invokelatest(setindex!, xs, v, i)`


## [Generic Functions](#Generic-Functions)
```julia-repl
julia> @macroexpand @invokelatest f(x; kw=kwv)
:(Base.invokelatest(f, x; kw = kwv))

julia> @macroexpand @invokelatest x.f
:(Base.invokelatest(Base.getproperty, x, :f))

julia> @macroexpand @invokelatest x.f = v
:(Base.invokelatest(Base.setproperty!, x, :f, v))

julia> @macroexpand @invokelatest xs[i]
:(Base.invokelatest(Base.getindex, xs, i))

julia> @macroexpand @invokelatest xs[i] = v
:(Base.invokelatest(Base.setindex!, xs, v, i))
```
This macro requires Julia 1.7 or later.
Prior to Julia 1.9, this macro was not exported, and was called as `Base.@invokelatest`.
The additional `x.f` and `xs[i]` syntax requires Julia 1.10.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2693-L2731)
```julia
new, or new{A,B,...}
```
Special function available to inner constructors which creates a new object of the type. The form new{A,B,...} explicitly specifies values of parameters for parametric types. See the manual section on [Inner Constructor Methods](../../manual/constructors/#man-inner-constructor-methods) for more information.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1450-L1457)
```julia
|>(x, f)
```
Infix operator which applies function `f` to the argument `x`. This allows `f(g(x))` to be written `x |> g |> f`. When used with anonymous functions, parentheses are typically required around the definition to get the intended chain.
**Examples**


## [Generic Functions](#Generic-Functions)
```julia-repl
julia> 4 |> inv
0.25

julia> [2, 3, 5] |> sum |> inv
0.1

julia> [0 1; 2 3] .|> (x -> x^2) |> sum
14
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L906-L925)
```julia
f ∘ g
```
Compose functions: i.e. `(f ∘ g)(args...; kwargs...)` means `f(g(args...; kwargs...))`. The `∘` symbol can be entered in the Julia REPL (and most editors, appropriately configured) by typing `\circ<tab>`.
Function composition also works in prefix form: `∘(f, g)` is the same as `f ∘ g`. The prefix form supports composition of multiple functions: `∘(f, g, h) = f ∘ g ∘ h` and splatting `∘(fs...)` for composing an iterable collection of functions. The last argument to `∘` execute first.
Multiple function composition requires at least Julia 1.4.
Composition of one function ∘(f) requires at least Julia 1.5.
Using keyword arguments requires at least Julia 1.7.
**Examples**
```julia-repl
julia> map(uppercase∘first, ["apple", "banana", "carrot"])
3-element Vector{Char}:
 'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
 'B': ASCII/Unicode U+0042 (category Lu: Letter, uppercase)
 'C': ASCII/Unicode U+0043 (category Lu: Letter, uppercase)

julia> (==(6)∘length).(["apple", "banana", "carrot"])
3-element BitVector:
 0
 1
 1

julia> fs = [
           x -> 2x
           x -> x-1
           x -> x/2
           x -> x+1
       ];

julia> ∘(fs...)(3)
2.0
```
See also [`ComposedFunction`](#Base.ComposedFunction), [`!f::Function`](../math/#Base.:!).


## [Generic Functions](#Generic-Functions)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L964-L1009)
```julia
ComposedFunction{Outer,Inner} <: Function
```
Represents the composition of two callable objects `outer::Outer` and `inner::Inner`. That is
```julia
ComposedFunction(outer, inner)(args...; kw...) === outer(inner(args...; kw...))
```
The preferred way to construct an instance of `ComposedFunction` is to use the composition operator [`∘`](#Base.:∘):
```julia-repl
julia> sin ∘ cos === ComposedFunction(sin, cos)
true

julia> typeof(sin∘cos)
ComposedFunction{typeof(sin), typeof(cos)}
```
The composed pieces are stored in the fields of `ComposedFunction` and can be retrieved as follows:
```julia-repl
julia> composition = sin ∘ cos
sin ∘ cos

julia> composition.outer === sin
true

julia> composition.inner === cos
true
```
ComposedFunction requires at least Julia 1.6. In earlier versions `∘` returns an anonymous function instead.
See also [`∘`](#Base.:∘).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L1012-L1042)
```julia
splat(f)
```
Equivalent to
```julia
    my_splat(f) = args->f(args...)
```
i.e. given a function returns a new function that takes one argument and splats it into the original function. This is useful as an adaptor to pass a multi-argument function in a context that expects a single argument, but passes a tuple as that single argument.
**Examples**


## [Generic Functions](#Generic-Functions)
```julia-repl
julia> map(splat(+), zip(1:3,4:6))
3-element Vector{Int64}:
 5
 7
 9

julia> my_add = splat(+)
splat(+)

julia> my_add((1,2,3))
6
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L1233-L1259)
```julia
Fix1(f, x)
```
A type representing a partially-applied version of the two-argument function `f`, with the first argument fixed to the value "x". In other words, `Fix1(f, x)` behaves similarly to `y->f(x, y)`.
See also [`Fix2`](#Base.Fix2).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L1110-L1118)
```julia
Fix2(f, x)
```
A type representing a partially-applied version of the two-argument function `f`, with the second argument fixed to the value "x". In other words, `Fix2(f, x)` behaves similarly to `y->f(y, x)`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L1129-L1135)


## [Syntax](#Syntax)
```julia
Core.eval(m::Module, expr)
```
Evaluate an expression in the given module and return the result.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L195-L199)
```julia
eval(expr)
```
Evaluate an expression in the global scope of the containing module. Every `Module` (except those defined with `baremodule`) has its own 1-argument definition of `eval`, which evaluates expressions in that module.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysimg.jl#L41-L47)
```julia
@eval [mod,] ex
```
Evaluate an expression with values interpolated into it using `eval`. If two arguments are provided, the first is the module to evaluate in.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L463-L468)
```julia
evalfile(path::AbstractString, args::Vector{String}=String[])
```
Load the file into an anonymous module using [`include`](#Base.include), evaluate all expressions, and return the value of the last expression. The optional `args` argument can be used to set the input arguments of the script (i.e. the global `ARGS` variable). Note that definitions (e.g. methods, globals) are evaluated in the anonymous module and do not affect the current module.
**Examples**
```julia-repl
julia> write("testfile.jl", """
           @show ARGS
           1 + 1
       """);

julia> x = evalfile("testfile.jl", ["ARG1", "ARG2"]);
ARGS = ["ARG1", "ARG2"]

julia> x
2

julia> rm("testfile.jl")
```


## [Syntax](#Syntax)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L2804-L2828)
```julia
esc(e)
```
Only valid in the context of an [`Expr`](#Core.Expr) returned from a macro. Prevents the macro hygiene pass from turning embedded variables into gensym variables. See the [Macros](../../manual/metaprogramming/#man-macros) section of the Metaprogramming chapter of the manual for more details and examples.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L798-L804)
```julia
@inbounds(blk)
```
Eliminates array bounds checking within expressions.
In the example below the in-range check for referencing element `i` of array `A` is skipped to improve performance.
```julia
function sum(A::AbstractArray)
    r = zero(eltype(A))
    for i in eachindex(A)
        @inbounds r += A[i]
    end
    return r
end
```
Using `@inbounds` may return incorrect results/crashes/corruption for out-of-bounds indices. The user is responsible for checking it manually. Only use `@inbounds` when it is certain from the information locally available that all accesses are in bounds. In particular, using `1:length(A)` instead of `eachindex(A)` in a function like the one above is *not* safely inbounds because the first index of `A` may not be `1` for all user defined types that subtype `AbstractArray`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L855-L882)
```julia
@boundscheck(blk)
```


## [Syntax](#Syntax)
Annotates the expression `blk` as a bounds checking block, allowing it to be elided by [`@inbounds`](#Base.@inbounds).
The function in which `@boundscheck` is written must be inlined into its caller in order for `@inbounds` to have effect.
**Examples**
```julia-repl
julia> @inline function g(A, i)
           @boundscheck checkbounds(A, i)
           return "accessing ($A)[$i]"
       end;

julia> f1() = return g(1:2, -1);

julia> f2() = @inbounds return g(1:2, -1);

julia> f1()
ERROR: BoundsError: attempt to access 2-element UnitRange{Int64} at index [-1]
Stacktrace:
 [1] throw_boundserror(::UnitRange{Int64}, ::Tuple{Int64}) at ./abstractarray.jl:455
 [2] checkbounds at ./abstractarray.jl:420 [inlined]
 [3] g at ./none:2 [inlined]
 [4] f1() at ./none:1
 [5] top-level scope

julia> f2()
"accessing (1:2)[-1]"
```
The `@boundscheck` annotation allows you, as a library writer, to opt-in to allowing *other code* to remove your bounds checks with [`@inbounds`](#Base.@inbounds). As noted there, the caller must verify—using information they can access—that their accesses are valid before using `@inbounds`. For indexing into your [`AbstractArray`](../arrays/#Core.AbstractArray) subclasses, for example, this involves checking the indices against its [`axes`](../arrays/#Base.axes-Tuple%7BAny%7D). Therefore, `@boundscheck` annotations should only be added to a [`getindex`](../collections/#Base.getindex) or [`setindex!`](../collections/#Base.setindex!) implementation after you are certain its behavior is correct.


## [Syntax](#Syntax)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L807-L850)
```julia
@propagate_inbounds
```
Tells the compiler to inline a function while retaining the caller's inbounds context.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L884-L888)
```julia
@inline
```
Give a hint to the compiler that this function is worth inlining.
Small functions typically do not need the `@inline` annotation, as the compiler does it automatically. By using `@inline` on bigger functions, an extra nudge can be given to the compiler to inline it.
`@inline` can be applied immediately before a function definition or within a function body.
```julia
# annotate long-form definition
@inline function longdef(x)
    ...
end

# annotate short-form definition
@inline shortdef(x) = ...

# annotate anonymous function that a `do` block creates
f() do
    @inline
    ...
end
```
The usage within a function body requires at least Julia 1.8.
------------------------------------------------------------------------
```julia
@inline block
```
Give a hint to the compiler that calls within `block` are worth inlining.
```julia
# The compiler will try to inline `f`
@inline f(...)

# The compiler will try to inline `f`, `g` and `+`
@inline f(...) + g(...)
```
A callsite annotation always has the precedence over the annotation applied to the definition of the called function:


## [Syntax](#Syntax)
```julia
@noinline function explicit_noinline(args...)
    # body
end

let
    @inline explicit_noinline(args...) # will be inlined
end
```
When there are nested callsite annotations, the innermost annotation has the precedence:
```julia
@noinline let a0, b0 = ...
    a = @inline f(a0)  # the compiler will try to inline this call
    b = f(b0)          # the compiler will NOT try to inline this call
    return a, b
end
```
Although a callsite annotation will try to force inlining in regardless of the cost model, there are still chances it can't succeed in it. Especially, recursive calls can not be inlined even if they are annotated as `@inline`d.
The callsite annotation requires at least Julia 1.8.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L202-L275)
```julia
@noinline
```
Give a hint to the compiler that it should not inline a function.
Small functions are typically inlined automatically. By using `@noinline` on small functions, auto-inlining can be prevented.
`@noinline` can be applied immediately before a function definition or within a function body.
```julia
# annotate long-form definition
@noinline function longdef(x)
    ...
end

# annotate short-form definition
@noinline shortdef(x) = ...

# annotate anonymous function that a `do` block creates
f() do
    @noinline
    ...
end
```
The usage within a function body requires at least Julia 1.8.
------------------------------------------------------------------------
```julia
@noinline block
```


## [Syntax](#Syntax)
Give a hint to the compiler that it should not inline the calls within `block`.
```julia
# The compiler will try to not inline `f`
@noinline f(...)

# The compiler will try to not inline `f`, `g` and `+`
@noinline f(...) + g(...)
```
A callsite annotation always has the precedence over the annotation applied to the definition of the called function:
```julia
@inline function explicit_inline(args...)
    # body
end

let
    @noinline explicit_inline(args...) # will not be inlined
end
```
When there are nested callsite annotations, the innermost annotation has the precedence:
```julia
@inline let a0, b0 = ...
    a = @noinline f(a0)  # the compiler will NOT try to inline this call
    b = f(b0)            # the compiler will try to inline this call
    return a, b
end
```
The callsite annotation requires at least Julia 1.8.
------------------------------------------------------------------------
If the function is trivial (for example returning a constant) it might get inlined anyway.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L280-L352)
```julia
@nospecialize
```


## [Syntax](#Syntax)
Applied to a function argument name, hints to the compiler that the method implementation should not be specialized for different types of that argument, but instead use the declared type for that argument. It can be applied to an argument within a formal argument list, or in the function body. When applied to an argument, the macro must wrap the entire argument expression, e.g., `@nospecialize(x::Real)` or `@nospecialize(i::Integer...)` rather than wrapping just the argument name. When used in a function body, the macro must occur in statement position and before any code.
When used without arguments, it applies to all arguments of the parent scope. In local scope, this means all arguments of the containing function. In global (top-level) scope, this means all methods subsequently defined in the current module.
Specialization can reset back to the default by using [`@specialize`](#Base.@specialize).
```julia
function example_function(@nospecialize x)
    ...
end

function example_function(x, @nospecialize(y = 1))
    ...
end

function example_function(x, y, z)
    @nospecialize x y
    ...
end

@nospecialize
f(y) = [x for x in y]
@specialize
```
`@nospecialize` affects code generation but not inference: it limits the diversity of the resulting native code, but it does not impose any limitations (beyond the standard ones) on type-inference. Use [`Base.@nospecializeinfer`](#Base.@nospecializeinfer) together with `@nospecialize` to additionally suppress inference.
**Examples**


## [Syntax](#Syntax)
```julia
julia> f(A::AbstractArray) = g(A)
f (generic function with 1 method)

julia> @noinline g(@nospecialize(A::AbstractArray)) = A[1]
g (generic function with 1 method)

julia> @code_typed f([1.0])
CodeInfo(
1 ─ %1 = invoke Main.g(_2::AbstractArray)::Float64
└──      return %1
) => Float64
```
Here, the `@nospecialize` annotation results in the equivalent of
```julia
f(A::AbstractArray) = invoke(g, Tuple{AbstractArray}, A)
```
ensuring that only one version of native code will be generated for `g`, one that is generic for any `AbstractArray`. However, the specific return type is still inferred for both `g` and `f`, and this is still used in optimizing the callers of `f` and `g`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L49-L119)
```julia
@specialize
```
Reset the specialization hint for an argument back to the default. For details, see [`@nospecialize`](#Base.@nospecialize).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L131-L136)
```julia
Base.@nospecializeinfer function f(args...)
    @nospecialize ...
    ...
end
Base.@nospecializeinfer f(@nospecialize args...) = ...
```
Tells the compiler to infer `f` using the declared types of `@nospecialize`d arguments. This can be used to limit the number of compiler-generated specializations during inference.
**Examples**


## [Syntax](#Syntax)
```julia
julia> f(A::AbstractArray) = g(A)
f (generic function with 1 method)

julia> @noinline Base.@nospecializeinfer g(@nospecialize(A::AbstractArray)) = A[1]
g (generic function with 1 method)

julia> @code_typed f([1.0])
CodeInfo(
1 ─ %1 = invoke Main.g(_2::AbstractArray)::Any
└──      return %1
) => Any
```
In this example, `f` will be inferred for each specific type of `A`, but `g` will only be inferred once with the declared argument type `A::AbstractArray`, meaning that the compiler will not likely see the excessive inference time on it while it can not infer the concrete return type of it. Without the `@nospecializeinfer`, `f([1.0])` would infer the return type of `g` as `Float64`, indicating that inference ran for `g(::Vector{Float64})` despite the prohibition on specialized code generation.
Using `Base.@nospecializeinfer` requires Julia version 1.10.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L843-L879)
```julia
Base.@constprop setting [ex]
```
Control the mode of interprocedural constant propagation for the annotated function.
Two `setting`s are supported:
-   `Base.@constprop :aggressive [ex]`: apply constant propagation aggressively. For a method where the return type depends on the value of the arguments, this can yield improved inference results at the cost of additional compile time.


## [Syntax](#Syntax)
-   `Base.@constprop :none [ex]`: disable constant propagation. This can reduce compile times for functions that Julia might otherwise deem worthy of constant-propagation. Common cases are for functions with `Bool`- or `Symbol`-valued arguments or keyword arguments.
`Base.@constprop` can be applied immediately before a function definition or within a function body.
```julia
# annotate long-form definition
Base.@constprop :aggressive function longdef(x)
    ...
end

# annotate short-form definition
Base.@constprop :aggressive shortdef(x) = ...

# annotate anonymous function that a `do` block creates
f() do
    Base.@constprop :aggressive
    ...
end
```
The usage within a function body requires at least Julia 1.10.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L357-L391)
```julia
gensym([tag])
```
Generates a symbol which will not conflict with other variable names (in the same module).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L9-L13)
```julia
@gensym
```
Generates a gensym symbol for a variable. For example, `@gensym x y` is transformed into `x = gensym("x"); y = gensym("y")`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L21-L26)
```julia
var
```
The syntax `var"#example#"` refers to a variable named `Symbol("#example#")`, even though `#example#` is not a valid Julia identifier name.


## [Syntax](#Syntax)
This can be useful for interoperability with programming languages which have different rules for the construction of valid identifiers. For example, to refer to the `R` variable `draw.segments`, you can use `var"draw.segments"` in your Julia code.
It is also used to `show` julia source code which has gone through macro hygiene or otherwise contains variable names which can't be parsed normally.
Note that this syntax requires parser support so it is expanded directly by the parser rather than being implemented as a normal string macro `@var_str`.
This syntax requires at least Julia 1.3.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1496-L1516)
```julia
@goto name
```
`@goto name` unconditionally jumps to the statement at the location [`@label name`](#Base.@label).
`@label` and `@goto` cannot create jumps to different top-level statements. Attempts cause an error. To still use `@goto`, enclose the `@label` and `@goto` in a block.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L901-L908)
```julia
@label name
```
Labels a statement with the symbolic label `name`. The label marks the end-point of an unconditional jump with [`@goto name`](#Base.@goto).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L891-L896)
```julia
@simd
```
Annotate a `for` loop to allow the compiler to take extra liberties to allow loop re-ordering


## [Syntax](#Syntax)
This feature is experimental and could change or disappear in future versions of Julia. Incorrect use of the `@simd` macro may cause unexpected results.
The object iterated over in a `@simd for` loop should be a one-dimensional range. By using `@simd`, you are asserting several properties of the loop:
-   It is safe to execute iterations in arbitrary or overlapping order, with special consideration for reduction variables.
-   Floating-point operations on reduction variables can be reordered or contracted, possibly causing different results than without `@simd`.
In many cases, Julia is able to automatically vectorize inner for loops without the use of `@simd`. Using `@simd` gives the compiler a little extra leeway to make it possible in more situations. In either case, your inner loop should have the following properties to allow vectorization:
-   The loop must be an innermost loop
-   The loop body must be straight-line code. Therefore, [`@inbounds`](#Base.@inbounds) is currently needed for all array accesses. The compiler can sometimes turn short `&&`, `||`, and `?:` expressions into straight-line code if it is safe to evaluate all operands unconditionally. Consider using the [`ifelse`](#Base.ifelse) function instead of `?:` in the loop if it is safe to do so.
-   Accesses must have a stride pattern and cannot be "gathers" (random-index reads) or "scatters" (random-index writes).
-   The stride should be unit stride.


## [Syntax](#Syntax)
The `@simd` does not assert by default that the loop is completely free of loop-carried memory dependencies, which is an assumption that can easily be violated in generic code. If you are writing non-generic code, you can use `@simd ivdep for ... end` to also assert that:
-   There exists no loop-carried memory dependencies
-   No iteration ever waits on a previous iteration to make forward progress.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/simdloop.jl#L90-L126)
```julia
@polly
```
Tells the compiler to apply the polyhedral optimizer Polly to a function.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L897-L901)
```julia
@generated f
```
`@generated` is used to annotate a function which will be generated. In the body of the generated function, only types of arguments can be read (not the values). The function returns a quoted expression evaluated when the function is called. The `@generated` macro should not be used on functions mutating the global scope or depending on mutable elements.
See [Metaprogramming](../../manual/metaprogramming/#Metaprogramming) for further details.
**Examples**
```julia-repl
julia> @generated function bar(x)
           if x <: Integer
               return :(x ^ 2)
           else
               return :(x)
           end
       end
bar (generic function with 1 method)

julia> bar(4)
16

julia> bar("baz")
"baz"
```


## [Syntax](#Syntax)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L1075-L1103)
```julia
Base.@assume_effects setting... [ex]
```
Override the compiler's effect modeling. This macro can be used in several contexts:
1.  Immediately before a method definition, to override the entire effect modeling of the applied method.
2.  Within a function body without any arguments, to override the entire effect modeling of the enclosing method.
3.  Applied to a code block, to override the local effect modeling of the applied code block.
**Examples**
```julia-repl
julia> Base.@assume_effects :terminates_locally function fact(x)
           # usage 1:
           # this :terminates_locally allows `fact` to be constant-folded
           res = 1
           0 ≤ x < 20 || error("bad fact")
           while x > 1
               res *= x
               x -= 1
           end
           return res
       end
fact (generic function with 1 method)

julia> code_typed() do
           fact(12)
       end |> only
CodeInfo(
1 ─     return 479001600
) => Int64

julia> code_typed() do
           map((2,3,4)) do x
               # usage 2:
               # this :terminates_locally allows this anonymous function to be constant-folded
               Base.@assume_effects :terminates_locally
               res = 1
               0 ≤ x < 20 || error("bad fact")
               while x > 1
                   res *= x
                   x -= 1
               end
               return res
           end
       end |> only
CodeInfo(
1 ─     return (2, 6, 24)
) => Tuple{Int64, Int64, Int64}

julia> code_typed() do
           map((2,3,4)) do x
               res = 1
               0 ≤ x < 20 || error("bad fact")
               # usage 3:
               # with this :terminates_locally annotation the compiler skips tainting
               # `:terminates` effect within this `while` block, allowing the parent
               # anonymous function to be constant-folded
               Base.@assume_effects :terminates_locally while x > 1
                   res *= x
                   x -= 1
               end
               return res
           end
       end |> only
CodeInfo(
1 ─     return (2, 6, 24)
) => Tuple{Int64, Int64, Int64}
```


## [Syntax](#Syntax)
Using `Base.@assume_effects` requires Julia version 1.8.
The usage within a function body requires at least Julia 1.10.
The code block annotation requires at least Julia 1.11.
Improper use of this macro causes undefined behavior (including crashes, incorrect answers, or other hard to track bugs). Use with care and only as a last resort if absolutely required. Even in such a case, you SHOULD take all possible steps to minimize the strength of the effect assertion (e.g., do not use `:total` if `:nothrow` would have been sufficient).
In general, each `setting` value makes an assertion about the behavior of the function, without requiring the compiler to prove that this behavior is indeed true. These assertions are made for all world ages. It is thus advisable to limit the use of generic functions that may later be extended to invalidate the assumption (which would cause undefined behavior).
The following `setting`s are supported.
-   `:consistent`
-   `:effect_free`
-   `:nothrow`
-   `:terminates_globally`
-   `:terminates_locally`
-   `:notaskstate`
-   `:inaccessiblememonly`
-   `:noub`
-   `:noub_if_noinbounds`
-   `:nortcall`
-   `:foldable`
-   `:removable`
-   `:total`
**Extended help**
------------------------------------------------------------------------
**`:consistent`**
The `:consistent` setting asserts that for egal (`===`) inputs:
-   The manner of termination (return value, exception, non-termination) will always be the same.
-   If the method returns, the results will always be egal.


## [Syntax](#Syntax)
This in particular implies that the method must not return a freshly allocated mutable object. Multiple allocations of mutable objects (even with identical contents) are not egal.
The `:consistent`-cy assertion is made world-age wise. More formally, write $fᵢ$ for the evaluation of $f$ in world-age $i$, then this setting requires:
\\\[∀ i, x, y: x ≡ y → fᵢ(x) ≡ fᵢ(y)\\\]
However, for two world ages $i$, $j$ s.t. $i ≠ j$, we may have $fᵢ(x) ≢ fⱼ(y)$.
A further implication is that `:consistent` functions may not make their return value dependent on the state of the heap or any other global state that is not constant for a given world age.
The `:consistent`-cy includes all legal rewrites performed by the optimizer. For example, floating-point fastmath operations are not considered `:consistent`, because the optimizer may rewrite them causing the output to not be `:consistent`, even for the same world age (e.g. because one ran in the interpreter, while the other was optimized).
If `:consistent` functions terminate by throwing an exception, that exception itself is not required to meet the egality requirement specified above.
------------------------------------------------------------------------
**`:effect_free`**
The `:effect_free` setting asserts that the method is free of externally semantically visible side effects. The following is an incomplete list of externally semantically visible side effects:
-   Changing the value of a global variable.
-   Mutating the heap (e.g. an array or mutable value), except as noted below


## [Syntax](#Syntax)
-   Changing the method table (e.g. through calls to eval)
-   File/Network/etc. I/O
-   Task switching
However, the following are explicitly not semantically visible, even if they may be observable:
-   Memory allocations (both mutable and immutable)
-   Elapsed time
-   Garbage collection
-   Heap mutations of objects whose lifetime does not exceed the method (i.e. were allocated in the method and do not escape).
-   The returned value (which is externally visible, but not a side effect)
The rule of thumb here is that an externally visible side effect is anything that would affect the execution of the remainder of the program if the function were not executed.
The `:effect_free` assertion is made both for the method itself and any code that is executed by the method. Keep in mind that the assertion must be valid for all world ages and limit use of this assertion accordingly.
------------------------------------------------------------------------
**`:nothrow`**
The `:nothrow` settings asserts that this method does not throw an exception (i.e. will either always return a value or never return).
It is permissible for `:nothrow` annotated methods to make use of exception handling internally as long as the exception is not rethrown out of the method itself.


## [Syntax](#Syntax)
If the execution of a method may raise `MethodError`s and similar exceptions, then the method is not considered as `:nothrow`. However, note that environment-dependent errors like `StackOverflowError` or `InterruptException` are not modeled by this effect and thus a method that may result in `StackOverflowError` does not necessarily need to be `!:nothrow` (although it should usually be `!:terminates` too).
------------------------------------------------------------------------
**`:terminates_globally`**
The `:terminates_globally` settings asserts that this method will eventually terminate (either normally or abnormally), i.e. does not loop indefinitely.
This `:terminates_globally` assertion covers any other methods called by the annotated method.
The compiler will consider this a strong indication that the method will terminate relatively *quickly* and may (if otherwise legal) call this method at compile time. I.e. it is a bad idea to annotate this setting on a method that *technically*, but not *practically*, terminates.
------------------------------------------------------------------------
**`:terminates_locally`**
The `:terminates_locally` setting is like `:terminates_globally`, except that it only applies to syntactic control flow *within* the annotated method. It is thus a much weaker (and thus safer) assertion that allows for the possibility of non-termination if the method calls some other method that does not terminate.
`:terminates_globally` implies `:terminates_locally`.


## [Syntax](#Syntax)
------------------------------------------------------------------------
**`:notaskstate`**
The `:notaskstate` setting asserts that the method does not use or modify the local task state (task local storage, RNG state, etc.) and may thus be safely moved between tasks without observable results.
The implementation of exception handling makes use of state stored in the task object. However, this state is currently not considered to be within the scope of `:notaskstate` and is tracked separately using the `:nothrow` effect.
The `:notaskstate` assertion concerns the state of the *currently running task*. If a reference to a `Task` object is obtained by some other means that does not consider which task is *currently* running, the `:notaskstate` effect need not be tainted. This is true, even if said task object happens to be `===` to the currently running task.
Access to task state usually also results in the tainting of other effects, such as `:effect_free` (if task state is modified) or `:consistent` (if task state is used in the computation of the result). In particular, code that is not `:notaskstate`, but is `:effect_free` and `:consistent` may still be dead-code-eliminated and thus promoted to `:total`.
------------------------------------------------------------------------
**`:inaccessiblememonly`**


## [Syntax](#Syntax)
The `:inaccessiblememonly` setting asserts that the method does not access or modify externally accessible mutable memory. This means the method can access or modify mutable memory for newly allocated objects that is not accessible by other methods or top-level execution before return from the method, but it can not access or modify any mutable global state or mutable memory pointed to by its arguments.
Below is an incomplete list of examples that invalidate this assumption:
-   a global reference or `getglobal` call to access a mutable global variable
-   a global assignment or `setglobal!` call to perform assignment to a non-constant global variable
-   `setfield!` call that changes a field of a global mutable variable
This `:inaccessiblememonly` assertion covers any other methods called by the annotated method.
------------------------------------------------------------------------
**`:noub`**
The `:noub` setting asserts that the method will not execute any undefined behavior (for any input). Note that undefined behavior may technically cause the method to violate any other effect assertions (such as `:consistent` or `:effect_free`) as well, but we do not model this, and they assume the absence of undefined behavior.
------------------------------------------------------------------------
**`:nortcall`**
The `:nortcall` setting asserts that the method does not call `Core.Compiler.return_type`, and that any other methods this method might call also do not call `Core.Compiler.return_type`.


## [Syntax](#Syntax)
To be precise, this assertion can be used when a call to `Core.Compiler.return_type` is not made at runtime; that is, when the result of `Core.Compiler.return_type` is known exactly at compile time and the call is eliminated by the optimizer. However, since whether the result of `Core.Compiler.return_type` is folded at compile time depends heavily on the compiler's implementation, it is generally risky to assert this if the method in question uses `Core.Compiler.return_type` in any form.
------------------------------------------------------------------------
**`:foldable`**
This setting is a convenient shortcut for the set of effects that the compiler requires to be guaranteed to constant fold a call at compile time. It is currently equivalent to the following `setting`s:
-   `:consistent`
-   `:effect_free`
-   `:terminates_globally`
-   `:noub`
-   `:nortcall`
This list in particular does not include `:nothrow`. The compiler will still attempt constant propagation and note any thrown error at compile time. Note however, that by the `:consistent`-cy requirements, any such annotated call must consistently throw given the same argument values.
An explicit `@inbounds` annotation inside the function will also disable constant folding and not be overridden by `:foldable`.
------------------------------------------------------------------------
**`:removable`**


## [Syntax](#Syntax)
This setting is a convenient shortcut for the set of effects that the compiler requires to be guaranteed to delete a call whose result is unused at compile time. It is currently equivalent to the following `setting`s:
-   `:effect_free`
-   `:nothrow`
-   `:terminates_globally`
------------------------------------------------------------------------
**`:total`**
This `setting` is the maximum possible set of effects. It currently implies the following other `setting`s:
-   `:consistent`
-   `:effect_free`
-   `:nothrow`
-   `:terminates_globally`
-   `:notaskstate`
-   `:inaccessiblememonly`
-   `:noub`
-   `:nortcall`
`:total` is a very strong assertion and will likely gain additional semantics in future versions of Julia (e.g. if additional effects are added and included in the definition of `:total`). As a result, it should be used with care. Whenever possible, prefer to use the minimum possible set of specific effect assertions required for a particular application. In cases where a large number of effect overrides apply to a set of functions, a custom macro is recommended over the use of `:total`.
------------------------------------------------------------------------
**Negated effects**
Effect names may be prefixed by `!` to indicate that the effect should be removed from an earlier meta effect. For example, `:total !:nothrow` indicates that while the call is generally total, it may however throw.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L413-L758)


## [Managing deprecations](#Managing-deprecations)
```julia
@deprecate old new [export_old=true]
```
Deprecate method `old` and specify the replacement call `new`, defining a new method `old` with the specified signature in the process.
To prevent `old` from being exported, set `export_old` to `false`.
See also [`Base.depwarn()`](#Base.depwarn).
As of Julia 1.5, functions defined by `@deprecate` do not print warning when `julia` is run without the `--depwarn=yes` flag set, as the default value of `--depwarn` option is `no`. The warnings are printed from tests run by `Pkg.test()`.
**Examples**
```julia-repl
julia> @deprecate old(x) new(x)
old (generic function with 1 method)

julia> @deprecate old(x) new(x) false
old (generic function with 1 method)
```
Calls to `@deprecate` without explicit type-annotations will define deprecated methods accepting any number of positional and keyword arguments of type `Any`.
Keyword arguments are forwarded when there is no explicit type annotation as of Julia 1.9. For older versions, you can manually forward positional and keyword arguments by doing `@deprecate old(args...; kwargs...) new(args...; kwargs...)`.
To restrict deprecation to a specific signature, annotate the arguments of `old`. For example,
```julia-repl
julia> new(x::Int) = x;

julia> new(x::Float64) = 2x;

julia> @deprecate old(x::Int) new(x);

julia> methods(old)
# 1 method for generic function "old" from Main:
 [1] old(x::Int64)
     @ deprecated.jl:94
```


## [Managing deprecations](#Managing-deprecations)
will define and deprecate a method `old(x::Int)` that mirrors `new(x::Int)` but will not define nor deprecate the method `old(x::Float64)`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/deprecated.jl#L15-L65)
```julia
Base.depwarn(msg::String, funcsym::Symbol; force=false)
```
Print `msg` as a deprecation warning. The symbol `funcsym` should be the name of the calling function, which is used to ensure that the deprecation warning is only printed the first time for each call place. Set `force=true` to force the warning to always be shown, even if Julia was started with `--depwarn=no` (the default).
See also [`@deprecate`](#Base.@deprecate).
**Examples**
```julia
function deprecated_func()
    Base.depwarn("Don't use `deprecated_func()`!", :deprecated_func)

    1 + 1
end
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/deprecated.jl#L121-L140)


## [Missing Values](#Missing-Values)
```julia
Missing
```
A type with no fields whose singleton instance [`missing`](../../manual/missing/#missing) is used to represent missing values.
See also: [`skipmissing`](#Base.skipmissing), [`nonmissingtype`](#Base.nonmissingtype), [`Nothing`](#Core.Nothing).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1148-L1155)
```julia
missing
```
The singleton instance of type [`Missing`](#Base.Missing) representing a missing value.
See also: [`NaN`](../numbers/#Base.NaN), [`skipmissing`](#Base.skipmissing), [`nonmissingtype`](#Base.nonmissingtype).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1158-L1164)
```julia
coalesce(x...)
```
Return the first value in the arguments which is not equal to [`missing`](../../manual/missing/#missing), if any. Otherwise return `missing`.
See also [`skipmissing`](#Base.skipmissing), [`something`](#Base.something), [`@coalesce`](#Base.@coalesce).
**Examples**
```julia-repl
julia> coalesce(missing, 1)
1

julia> coalesce(1, missing)
1

julia> coalesce(nothing, 1)  # returns `nothing`

julia> coalesce(missing, missing)
missing
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/missing.jl#L395-L417)
```julia
@coalesce(x...)
```
Short-circuiting version of [`coalesce`](#Base.coalesce).
**Examples**


## [Missing Values](#Missing-Values)
```julia-repl
julia> f(x) = (println("f($x)"); missing);

julia> a = 1;

julia> a = @coalesce a f(2) f(3) error("`a` is still missing")
1

julia> b = missing;

julia> b = @coalesce b f(2) f(3) error("`b` is still missing")
f(2)
f(3)
ERROR: `b` is still missing
[...]
```
This macro is available as of Julia 1.7.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/missing.jl#L425-L450)
```julia
ismissing(x)
```
Indicate whether `x` is [`missing`](../../manual/missing/#missing).
See also: [`skipmissing`](#Base.skipmissing), [`isnothing`](#Base.isnothing), [`isnan`](../numbers/#Base.isnan).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1167-L1173)
```julia
skipmissing(itr)
```
Return an iterator over the elements in `itr` skipping [`missing`](../../manual/missing/#missing) values. The returned object can be indexed using indices of `itr` if the latter is indexable. Indices corresponding to missing values are not valid: they are skipped by [`keys`](../collections/#Base.keys) and [`eachindex`](../arrays/#Base.eachindex), and a `MissingException` is thrown when trying to use them.
Use [`collect`](../collections/#Base.collect-Tuple%7BAny%7D) to obtain an `Array` containing the non-`missing` values in `itr`. Note that even if `itr` is a multidimensional array, the result will always be a `Vector` since it is not possible to remove missings while preserving dimensions of the input.


## [Missing Values](#Missing-Values)
See also [`coalesce`](#Base.coalesce), [`ismissing`](#Base.ismissing), [`something`](#Base.something).
**Examples**
```julia-repl
julia> x = skipmissing([1, missing, 2])
skipmissing(Union{Missing, Int64}[1, missing, 2])

julia> sum(x)
3

julia> x[1]
1

julia> x[2]
ERROR: MissingException: the value at index (2,) is missing
[...]

julia> argmax(x)
3

julia> collect(keys(x))
2-element Vector{Int64}:
 1
 3

julia> collect(skipmissing([1, missing, 2]))
2-element Vector{Int64}:
 1
 2

julia> collect(skipmissing([1 missing; 2 missing]))
2-element Vector{Int64}:
 1
 2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/missing.jl#L183-L231)
```julia
nonmissingtype(T::Type)
```
If `T` is a union of types containing `Missing`, return a new type with `Missing` removed.
**Examples**
```julia-repl
julia> nonmissingtype(Union{Int64,Missing})
Int64

julia> nonmissingtype(Any)
Any
```
This function is exported as of Julia 1.3.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/missing.jl#L21-L38)


## [System](#System)
```julia
run(command, args...; wait::Bool = true)
```
Run a command object, constructed with backticks (see the [Running External Programs](../../manual/running-external-programs/#Running-External-Programs) section in the manual). Throws an error if anything goes wrong, including the process exiting with a non-zero status (when `wait` is true).
The `args...` allow you to pass through file descriptors to the command, and are ordered like regular unix file descriptors (eg `stdin, stdout, stderr, FD(3), FD(4)...`).
If `wait` is false, the process runs asynchronously. You can later wait for it and check its exit status by calling `success` on the returned process object.
When `wait` is false, the process' I/O streams are directed to `devnull`. When `wait` is true, I/O streams are shared with the parent process. Use [`pipeline`](#Base.pipeline-Tuple%7BAny,%20Any,%20Any,%20Vararg%7BAny%7D%7D) to control I/O redirection.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/process.jl#L493-L509)
```julia
devnull
```
Used in a stream redirect to discard all data written to it. Essentially equivalent to `/dev/null` on Unix or `NUL` on Windows. Usage:
```julia
run(pipeline(`cat test.txt`, devnull))
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1519-L1528)
```julia
success(command)
```


## [System](#System)
Run a command object, constructed with backticks (see the [Running External Programs](../../manual/running-external-programs/#Running-External-Programs) section in the manual), and tell whether it was successful (exited with a code of 0). An exception is raised if the process cannot be started.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/process.jl#L562-L568)
```julia
process_running(p::Process)
```
Determine whether a process is currently running.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/process.jl#L659-L663)
```julia
process_exited(p::Process)
```
Determine whether a process has exited.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/process.jl#L668-L672)
```julia
kill(p::Process, signum=Base.SIGTERM)
```
Send a signal to a process. The default is to terminate the process. Returns successfully if the process has already exited, but throws an error if killing the process failed for other reasons (e.g. insufficient permissions).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/process.jl#L614-L621)
```julia
Sys.set_process_title(title::AbstractString)
```
Set the process title. No-op on some operating systems.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L387-L391)
```julia
Sys.get_process_title()
```
Get the process title. On some systems, will always return an empty string.


## [System](#System)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L375-L379)
```julia
ignorestatus(command)
```
Mark a command object so that running it will not throw an error if the result code is non-zero.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L220-L224)
```julia
detach(command)
```
Mark a command object so that it will be run in a new process group, allowing it to outlive the julia process, and not have Ctrl-C interrupts passed to it.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L229-L233)
```julia
Cmd(cmd::Cmd; ignorestatus, detach, windows_verbatim, windows_hide, env, dir)
Cmd(exec::Vector{String})
```
Construct a new `Cmd` object, representing an external program and arguments, from `cmd`, while changing the settings of the optional keyword arguments:
-   `ignorestatus::Bool`: If `true` (defaults to `false`), then the `Cmd` will not throw an error if the return code is nonzero.
-   `detach::Bool`: If `true` (defaults to `false`), then the `Cmd` will be run in a new process group, allowing it to outlive the `julia` process and not have Ctrl-C passed to it.


## [System](#System)
-   `windows_verbatim::Bool`: If `true` (defaults to `false`), then on Windows the `Cmd` will send a command-line string to the process with no quoting or escaping of arguments, even arguments containing spaces. (On Windows, arguments are sent to a program as a single "command-line" string, and programs are responsible for parsing it into arguments. By default, empty arguments and arguments with spaces or tabs are quoted with double quotes `"` in the command line, and `\` or `"` are preceded by backslashes. `windows_verbatim=true` is useful for launching programs that parse their command line in nonstandard ways.) Has no effect on non-Windows systems.
-   `windows_hide::Bool`: If `true` (defaults to `false`), then on Windows no new console window is displayed when the `Cmd` is executed. This has no effect if a console is already open or on non-Windows systems.
-   `env`: Set environment variables to use when running the `Cmd`. `env` is either a dictionary mapping strings to strings, an array of strings of the form `"var=val"`, an array or tuple of `"var"=>val` pairs. In order to modify (rather than replace) the existing environment, initialize `env` with `copy(ENV)` and then set `env["var"]=val` as desired. To add to an environment block within a `Cmd` object without replacing all elements, use [`addenv()`](#Base.addenv) which will return a `Cmd` object with the updated environment.
-   `dir::AbstractString`: Specify a working directory for the command (instead of the current directory).


## [System](#System)
For any keywords that are not specified, the current settings from `cmd` are used.
Note that the `Cmd(exec)` constructor does not create a copy of `exec`. Any subsequent changes to `exec` will be reflected in the `Cmd` object.
The most common way to construct a `Cmd` object is with command literals (backticks), e.g.
```julia
`ls -l`
```
This can then be passed to the `Cmd` constructor to modify its settings, e.g.
```julia
Cmd(`echo "Hello world"`, ignorestatus=true, detach=false)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L43-L86)
```julia
setenv(command::Cmd, env; dir)
```
Set environment variables to use when running the given `command`. `env` is either a dictionary mapping strings to strings, an array of strings of the form `"var=val"`, or zero or more `"var"=>val` pair arguments. In order to modify (rather than replace) the existing environment, create `env` through `copy(ENV)` and then setting `env["var"]=val` as desired, or use [`addenv`](#Base.addenv).
The `dir` keyword argument can be used to specify a working directory for the command. `dir` defaults to the currently set `dir` for `command` (which is the current working directory if not specified already).
See also [`Cmd`](#Base.Cmd), [`addenv`](#Base.addenv), [`ENV`](#Base.ENV), [`pwd`](../file/#Base.Filesystem.pwd).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L254-L268)
```julia
addenv(command::Cmd, env...; inherit::Bool = true)
```


## [System](#System)
Merge new environment mappings into the given [`Cmd`](#Base.Cmd) object, returning a new `Cmd` object. Duplicate keys are replaced. If `command` does not contain any environment values set already, it inherits the current environment at time of `addenv()` call if `inherit` is `true`. Keys with value `nothing` are deleted from the env.
See also [`Cmd`](#Base.Cmd), [`setenv`](#Base.setenv), [`ENV`](#Base.ENV).
This function requires Julia 1.6 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L283-L295)
```julia
withenv(f, kv::Pair...)
```
Execute `f` in an environment that is temporarily modified (not replaced as in `setenv`) by zero or more `"var"=>val` arguments `kv`. `withenv` is generally used via the `withenv(kv...) do ... end` syntax. A value of `nothing` can be used to temporarily unset an environment variable (if it is set). When `withenv` returns, the original environment has been restored.
Changing the environment is not thread-safe. For running external commands with a different environment from the parent process, prefer using [`addenv`](#Base.addenv) over `withenv`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/env.jl#L246-L258)
```julia
setcpuaffinity(original_command::Cmd, cpus) -> command::Cmd
```
Set the CPU affinity of the `command` by a list of CPU IDs (1-based) `cpus`. Passing `cpus = nothing` means to unset the CPU affinity if the `original_command` has any.


## [System](#System)
This function is supported only in Linux and Windows. It is not supported in macOS because libuv does not support affinity setting.
This function requires at least Julia 1.8.
**Examples**
In Linux, the `taskset` command line program can be used to see how `setcpuaffinity` works.
```julia
julia> run(setcpuaffinity(`sh -c 'taskset -p $$'`, [1, 2, 5]));
pid 2273's current affinity mask: 13
```
Note that the mask value `13` reflects that the first, second, and the fifth bits (counting from the least significant position) are turned on:
```julia
julia> 0b010011
0x13
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L325-L353)
```julia
pipeline(from, to, ...)
```
Create a pipeline from a data source to a destination. The source and destination can be commands, I/O streams, strings, or results of other `pipeline` calls. At least one argument must be a command. Strings refer to filenames. When called with more than two arguments, they are chained together from left to right. For example, `pipeline(a,b,c)` is equivalent to `pipeline(pipeline(a,b),c)`. This provides a more concise way to specify multi-stage pipelines.
**Examples**:
```julia
run(pipeline(`ls`, `grep xyz`))
run(pipeline(`ls`, "out.txt"))
run(pipeline("out.txt", `grep xyz`))
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L409-L426)
```julia
pipeline(command; stdin, stdout, stderr, append=false)
```


## [System](#System)
Redirect I/O to or from the given `command`. Keyword arguments specify which of the command's streams should be redirected. `append` controls whether file output appends to the file. This is a more general version of the 2-argument `pipeline` function. `pipeline(from, to)` is equivalent to `pipeline(from, stdout=to)` when `from` is a command, and to `pipeline(to, stdin=from)` when `from` is another kind of data source.
**Examples**:
```julia
run(pipeline(`dothings`, stdout="out.txt", stderr="errs.txt"))
run(pipeline(`update`, stdout="log.txt", append=true))
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/cmd.jl#L374-L389)
```julia
gethostname() -> String
```
Get the local machine's host name.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/libc.jl#L298-L302)
```julia
getpid() -> Int32
```
Get Julia's process ID.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/libc.jl#L289-L293)
```julia
getpid(process) -> Int32
```
Get the child process ID, if it still exists.
This function requires at least Julia 1.1.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/process.jl#L637-L644)
```julia
time() -> Float64
```
Get the system time in seconds since the epoch, with fairly high (typically, microsecond) resolution.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/libc.jl#L280-L284)
```julia
time_ns() -> UInt64
```


## [System](#System)
Get the time in nanoseconds relative to some machine-specific arbitrary time in the past. The primary use is for measuring elapsed times during program execution. The return value is guaranteed to be monotonic (mod 2⁶⁴) while the system is running, and is unaffected by clock drift or changes to local calendar time, but it may change arbitrarily across system reboots or suspensions.
(Although the returned time is always in nanoseconds, the timing resolution is platform-dependent.)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/Base.jl#L151-L160)
```julia
@time expr
@time "description" expr
```
A macro to execute an expression, printing the time it took to execute, the number of allocations, and the total number of bytes its execution caused to be allocated, before returning the value of the expression. Any time spent garbage collecting (gc), compiling new code, or recompiling invalidated code is shown as a percentage. Any lock conflicts where a [`ReentrantLock`](../parallel/#Base.ReentrantLock) had to wait are shown as a count.
Optionally provide a description string to print before the time report.
In some cases the system will look inside the `@time` expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run `@time @eval ...`.


## [System](#System)
See also [`@showtime`](#Base.@showtime), [`@timev`](#Base.@timev), [`@timed`](#Base.@timed), [`@elapsed`](#Base.@elapsed), [`@allocated`](#Base.@allocated), and [`@allocations`](#Base.@allocations).
For more serious benchmarking, consider the `@btime` macro from the BenchmarkTools.jl package which among other things evaluates the function multiple times in order to reduce noise.
The option to add a description was introduced in Julia 1.8.
Recompilation time being shown separately from compilation time was introduced in Julia 1.8
The reporting of any lock conflicts was added in Julia 1.11.
```julia-repl
julia> x = rand(10,10);

julia> @time x * x;
  0.606588 seconds (2.19 M allocations: 116.555 MiB, 3.75% gc time, 99.94% compilation time)

julia> @time x * x;
  0.000009 seconds (1 allocation: 896 bytes)

julia> @time begin
           sleep(0.3)
           1+1
       end
  0.301395 seconds (8 allocations: 336 bytes)
2

julia> @time "A one second sleep" sleep(1)
A one second sleep: 1.005750 seconds (5 allocations: 144 bytes)

julia> for loop in 1:3
            @time loop sleep(1)
        end
1: 1.006760 seconds (5 allocations: 144 bytes)
2: 1.001263 seconds (5 allocations: 144 bytes)
3: 1.003676 seconds (5 allocations: 144 bytes)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L254-L312)
```julia
@showtime expr
```
Like `@time` but also prints the expression being evaluated for reference.
This macro was added in Julia 1.8.
See also [`@time`](../../manual/profile/#@time).


## [System](#System)
```julia-repl
julia> @showtime sleep(1)
sleep(1): 1.002164 seconds (4 allocations: 128 bytes)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L327-L341)
```julia
@timev expr
@timev "description" expr
```
This is a verbose version of the `@time` macro. It first prints the same information as `@time`, then any non-zero memory allocation counters, and then returns the value of the expression.
Optionally provide a description string to print before the time report.
The option to add a description was introduced in Julia 1.8.
See also [`@time`](../../manual/profile/#@time), [`@timed`](#Base.@timed), [`@elapsed`](#Base.@elapsed), [`@allocated`](#Base.@allocated), and [`@allocations`](#Base.@allocations).
```julia-repl
julia> x = rand(10,10);

julia> @timev x * x;
  0.546770 seconds (2.20 M allocations: 116.632 MiB, 4.23% gc time, 99.94% compilation time)
elapsed time (ns): 546769547
gc time (ns):      23115606
bytes allocated:   122297811
pool allocs:       2197930
non-pool GC allocs:1327
malloc() calls:    36
realloc() calls:   5
GC pauses:         3

julia> @timev x * x;
  0.000010 seconds (1 allocation: 896 bytes)
elapsed time (ns): 9848
bytes allocated:   896
pool allocs:       1
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L348-L384)
```julia
@timed
```


## [System](#System)
A macro to execute an expression, and return the value of the expression, elapsed time in seconds, total bytes allocated, garbage collection time, an object with various memory allocation counters, compilation time in seconds, and recompilation time in seconds. Any lock conflicts where a [`ReentrantLock`](../parallel/#Base.ReentrantLock) had to wait are shown as a count.
In some cases the system will look inside the `@timed` expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run `@timed @eval ...`.
See also [`@time`](../../manual/profile/#@time), [`@timev`](#Base.@timev), [`@elapsed`](#Base.@elapsed), [`@allocated`](#Base.@allocated), [`@allocations`](#Base.@allocations), and [`@lock_conflicts`](#Base.@lock_conflicts).
```julia-repl
julia> stats = @timed rand(10^6);

julia> stats.time
0.006634834

julia> stats.bytes
8000256

julia> stats.gctime
0.0055765

julia> propertynames(stats.gcstats)
(:allocd, :malloc, :realloc, :poolalloc, :bigalloc, :freecall, :total_time, :pause, :full_sweep)

julia> stats.gcstats.total_time
5576500

julia> stats.compile_time
0.0

julia> stats.recompile_time
0.0
```
The return type of this macro was changed from `Tuple` to `NamedTuple` in Julia 1.5.
The `lock_conflicts`, `compile_time`, and `recompile_time` fields were added in Julia 1.11.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L525-L571)
```julia
@elapsed
```


## [System](#System)
A macro to evaluate an expression, discarding the resulting value, instead returning the number of seconds it took to execute as a floating-point number.
In some cases the system will look inside the `@elapsed` expression and compile some of the called code before execution of the top-level expression begins. When that happens, some compilation time will not be counted. To include this time you can run `@elapsed @eval ...`.
See also [`@time`](../../manual/profile/#@time), [`@timev`](#Base.@timev), [`@timed`](#Base.@timed), [`@allocated`](#Base.@allocated), and [`@allocations`](#Base.@allocations).
```julia-repl
julia> @elapsed sleep(0.3)
0.301391426
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L399-L416)
```julia
@allocated
```
A macro to evaluate an expression, discarding the resulting value, instead returning the total number of bytes allocated during evaluation of the expression.
See also [`@allocations`](#Base.@allocations), [`@time`](../../manual/profile/#@time), [`@timev`](#Base.@timev), [`@timed`](#Base.@timed), and [`@elapsed`](#Base.@elapsed).
```julia-repl
julia> @allocated rand(10^6)
8000080
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L435-L448)
```julia
@allocations
```
A macro to evaluate an expression, discard the resulting value, and instead return the total number of allocations during evaluation of the expression.


## [System](#System)
See also [`@allocated`](#Base.@allocated), [`@time`](../../manual/profile/#@time), [`@timev`](#Base.@timev), [`@timed`](#Base.@timed), and [`@elapsed`](#Base.@elapsed).
```julia-repl
julia> @allocations rand(10^6)
2
```
This macro was added in Julia 1.9.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L461-L477)
```julia
@lock_conflicts
```
A macro to evaluate an expression, discard the resulting value, and instead return the total number of lock conflicts during evaluation, where a lock attempt on a [`ReentrantLock`](../parallel/#Base.ReentrantLock) resulted in a wait because the lock was already held.
See also [`@time`](../../manual/profile/#@time), [`@timev`](#Base.@timev) and [`@timed`](#Base.@timed).
```julia-repl
julia> @lock_conflicts begin
    l = ReentrantLock()
    Threads.@threads for i in 1:Threads.nthreads()
        lock(l) do
        sleep(1)
        end
    end
end
5
```
This macro was added in Julia 1.11.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L488-L511)
```julia
EnvDict() -> EnvDict
```
A singleton of this type provides a hash table interface to environment variables.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/env.jl#L76-L80)
```julia
ENV
```
Reference to the singleton `EnvDict`, providing a dictionary interface to system environment variables.


## [System](#System)
(On Windows, system environment variables are case-insensitive, and `ENV` correspondingly converts all keys to uppercase for display, iteration, and copying. Portable code should not rely on the ability to distinguish variables by case, and should beware that setting an ostensibly lowercase variable may result in an uppercase `ENV` key.)
Mutating the environment is not thread-safe.
**Examples**
```julia-repl
julia> ENV
Base.EnvDict with "50" entries:
  "SECURITYSESSIONID"            => "123"
  "USER"                         => "username"
  "MallocNanoZone"               => "0"
  ⋮                              => ⋮

julia> ENV["JULIA_EDITOR"] = "vim"
"vim"

julia> ENV["JULIA_EDITOR"]
"vim"
```
See also: [`withenv`](#Base.withenv), [`addenv`](#Base.addenv).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/env.jl#L83-L114)
```julia
Sys.STDLIB::String
```
A string containing the full path to the directory containing the `stdlib` packages.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L50-L54)
```julia
Sys.isunix([os])
```
Predicate for testing if the OS provides a Unix-like interface. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L407-L412)
```julia
Sys.isapple([os])
```


## [System](#System)
Predicate for testing if the OS is a derivative of Apple Macintosh OS X or Darwin. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L514-L519)
```julia
Sys.islinux([os])
```
Predicate for testing if the OS is a derivative of Linux. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L429-L434)
```julia
Sys.isbsd([os])
```
Predicate for testing if the OS is a derivative of BSD. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
The Darwin kernel descends from BSD, which means that `Sys.isbsd()` is `true` on macOS systems. To exclude macOS from a predicate, use `Sys.isbsd() && !Sys.isapple()`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L437-L447)
```julia
Sys.isfreebsd([os])
```
Predicate for testing if the OS is a derivative of FreeBSD. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).


## [System](#System)
Not to be confused with `Sys.isbsd()`, which is `true` on FreeBSD but also on other BSD-based systems. `Sys.isfreebsd()` refers only to FreeBSD.
This function requires at least Julia 1.1.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L450-L461)
```julia
Sys.isopenbsd([os])
```
Predicate for testing if the OS is a derivative of OpenBSD. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
Not to be confused with `Sys.isbsd()`, which is `true` on OpenBSD but also on other BSD-based systems. `Sys.isopenbsd()` refers only to OpenBSD.
This function requires at least Julia 1.1.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L464-L475)
```julia
Sys.isnetbsd([os])
```
Predicate for testing if the OS is a derivative of NetBSD. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
Not to be confused with `Sys.isbsd()`, which is `true` on NetBSD but also on other BSD-based systems. `Sys.isnetbsd()` refers only to NetBSD.
This function requires at least Julia 1.1.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L478-L489)
```julia
Sys.isdragonfly([os])
```


## [System](#System)
Predicate for testing if the OS is a derivative of DragonFly BSD. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
Not to be confused with `Sys.isbsd()`, which is `true` on DragonFly but also on other BSD-based systems. `Sys.isdragonfly()` refers only to DragonFly.
This function requires at least Julia 1.1.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L492-L503)
```julia
Sys.iswindows([os])
```
Predicate for testing if the OS is a derivative of Microsoft Windows NT. See documentation in [Handling Operating System Variation](../../manual/handling-operating-system-variation/#Handling-Operating-System-Variation).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L506-L511)
```julia
Sys.windows_version()
```
Return the version number for the Windows NT Kernel as a `VersionNumber`, i.e. `v"major.minor.build"`, or `v"0.0.0"` if this is not running on Windows.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L546-L551)
```julia
Sys.free_memory()
```
Get the total free memory in RAM in bytes.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L351-L355)
```julia
Sys.total_memory()
```


## [System](#System)
Get the total memory in RAM (including that which is currently used) in bytes. This amount may be constrained, e.g., by Linux control groups. For the unconstrained amount, see `Sys.total_physical_memory()`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L358-L364)
```julia
Sys.free_physical_memory()
```
Get the free memory of the system in bytes. The entire amount may not be available to the current process; use `Sys.free_memory()` for the actually available amount.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L335-L340)
```julia
Sys.total_physical_memory()
```
Get the total memory in RAM (including that which is currently used) in bytes. The entire amount may not be available to the current process; see `Sys.total_memory()`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L343-L348)
```julia
Sys.uptime()
```
Gets the current system uptime in seconds.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L312-L316)
```julia
Sys.isjsvm([os])
```
Predicate for testing if Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser.
This function requires at least Julia 1.2.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L522-L530)
```julia
Sys.loadavg()
```


## [System](#System)
Get the load average. See: https://en.wikipedia.org/wiki/Load\_(computing).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L324-L328)
```julia
isexecutable(path::String)
```
Return `true` if the given `path` has executable permissions.
This permission may change before the user executes `path`, so it is recommended to execute the file and handle the error if that fails, rather than calling `isexecutable` first.
Prior to Julia 1.6, this did not correctly interrogate filesystem ACLs on Windows, therefore it would return `true` for any file. From Julia 1.6 on, it correctly determines whether the file is marked as executable or not.
See also [`ispath`](../file/#Base.Filesystem.ispath), [`isreadable`](../io-network/#Base.isreadable), [`iswritable`](../io-network/#Base.iswritable).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/filesystem.jl#L369-L386)
```julia
isreadable(path::String)
```
Return `true` if the access permissions for the given `path` permitted reading by the current user.
This permission may change before the user calls `open`, so it is recommended to just call `open` alone and handle the error if that fails, rather than calling `isreadable` first.
Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.
This function requires at least Julia 1.11.


## [System](#System)
See also [`ispath`](../file/#Base.Filesystem.ispath), [`isexecutable`](../io-network/#Base.isexecutable), [`iswritable`](../io-network/#Base.iswritable).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/filesystem.jl#L395-L413)
```julia
isreadable(io) -> Bool
```
Return `false` if the specified IO object is not readable.
**Examples**
```julia-repl
julia> open("myfile.txt", "w") do io
           print(io, "Hello world!");
           isreadable(io)
       end
false

julia> open("myfile.txt", "r") do io
           isreadable(io)
       end
true

julia> rm("myfile.txt")
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/io.jl#L136-L156)
```julia
iswritable(path::String)
```
Return `true` if the access permissions for the given `path` permitted writing by the current user.
This permission may change before the user calls `open`, so it is recommended to just call `open` alone and handle the error if that fails, rather than calling `iswritable` first.
Currently this function does not correctly interrogate filesystem ACLs on Windows, therefore it can return wrong results.
This function requires at least Julia 1.11.
See also [`ispath`](../file/#Base.Filesystem.ispath), [`isexecutable`](../io-network/#Base.isexecutable), [`isreadable`](../io-network/#Base.isreadable).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/filesystem.jl#L422-L440)
```julia
iswritable(io) -> Bool
```