# Base and Standard Library

**URL:** <https://discourse.julialang.org/t/base-and-standard-library/15272>\
**Category:** Internals & Design\
**Created:** [September 21, 2018, 12:17pm UTC](https://discourse.julialang.org/t/base-and-standard-library/15272 "2018-09-21T12:17:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [September 21, 2018, 12:17pm UTC](https://discourse.julialang.org/t/base-and-standard-library/15272/1 "2018-09-21T12:17:11Z")

</div>

With Julia 0.7 (and 1.0) “Base” and “Standard Library” seem to be different things.

Before (0.64 and lower), according to the Docs, Standard Library was the only library with module name “Base”, e.g. [`Base.exit`](https://docs.julialang.org/en/v0.6.4/stdlib/base/#Base.exit) and all the others.

Can you point me to some reasoning about this fact?

For me “Base” and “Standard Library” sound as synonym to each other, so why the distinction?

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 21, 2018, 12:23pm UTC](https://discourse.julialang.org/t/base-and-standard-library/15272/2 "2018-09-21T12:23:17Z")

</div>

`Base` is all the stuff that’s actually needed for the core language. The “Standard Library” are just regular packages that are installed with julia. Some of the functionality previously contained in `Base` has been moved to their own packages, to make it easier to update them without having to update the language itself (looking for a source for that one, I’m fairly certain I got it from the release notes or an issue on the github).

I’m sure if you search a bit on this forum, you’ll find many more reasons though.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [September 21, 2018, 12:54pm UTC](https://discourse.julialang.org/t/base-and-standard-library/15272/3 "2018-09-21T12:54:31Z")

</div>

ok, I understand that, thank you.  
I have searched in the [release notes](https://github.com/JuliaLang/julia/blob/master/HISTORY.md) but couldn’t find anything on a higher level of an explanation, only details on specific functions.

My confusion about this started with reading this question:

> [@Basic concept about multiple dispatch](https://discourse.julialang.org/t/basic-concept-about-multiple-dispatch/15270):
>
> hello, I found myself got confused about multiple dispatch. Take the function rand as an example: there’re a lot of method definitions across different files: in base/libc.jl: rand() = ccall(:rand, Cint, ()) rand(::Type{UInt32}) = ((rand() % UInt32) \<\< 16) ⊻ (rand() % UInt32) rand(::Type{Float64}) = rand(UInt32) / 2^32 and in stdlib/Random/src/Random.jl: rand(rng::AbstractRNG=GLOBAL\_RNG, ::Type{X}=Float64) where {X} = rand(rng, Sampler(rng, X, Val(1))) now I try to inspect which method defi…

Starting a new REPL (1.0):

```julia
julia> @which rand()
rand() in Random at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.0\Random\src\Random.jl:222

```

so I thought `rand()` is from the “Standard Library” because of the path "…\julia\ **stdlib** \v1.0\Random\src\Random.jl`.  
Looking into the documentation is confirming that.

Assuming that “The “Standard Library” are just regular packages” I would expect that there needs to be some ‘using’ statement to use something from the Standard Library, which is not the case for ‘rand()’.

So there are perhaps some implicit imports in the REPL.

In the mean time it has been somehow answered with

> [@Basic concept about multiple dispatch](https://discourse.julialang.org/t/basic-concept-about-multiple-dispatch/15270/11):
>
> Note that rand is porbably one of the more complicated functions with respect to it’s distribution in source files. The reason is that although most random number stuff is in the Random stdlib rand itself is considered to be so essential that it has been decided to make it available in base julia.

But still it seems to be not a real answer, more like “it is that way because it was decided to be that way”.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 21, 2018, 1:21pm UTC](https://discourse.julialang.org/t/base-and-standard-library/15272/4 "2018-09-21T13:21:37Z")

</div>

Well, `rand` still is just part of the `Random` stdlib - but as that has to be able to update even faster than e.g. `LinearAlgebra` to catch regressions in randomness, it makes even more sense to have it as a package on its own. At the same time, access to rng is essential and really important, so it should also be easily accessible, in this case without having to do `using Random`. I agree that this hides its origin, and maybe it can be thought about in the future, but at the moment it seems like a good compromise. The only immediate downside I see is that it’s not apparent that you have to do `]up` when you want to update the implementation of `rand` you’re using in case of a hotfix.

Take a [look](https://github.com/JuliaLang/julia/tree/master/stdlib) at the other packages in the stdlib, they’re mostly really just nice-to-haves that can also benefit from having a faster release cycle than julia itself.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [September 21, 2018, 1:46pm UTC](https://discourse.julialang.org/t/base-and-standard-library/15272/5 "2018-09-21T13:46:14Z")

</div>

Actually, the generic function `rand` is defined (empty) in Base and then extended in `Random` (as explained in that linked thread). So no need to do `using Random`, the methods of rand defined in Random are just around. I think this is a bit different to other packages, for which the methods only come into existence after `using` that package. Presumably because it is backed into the sysimg.
