Dates in Base?


#1

It’s confusing that Dates is in Base and it’s a package that can be added. How can I understand this better (where is it documented)? What other modules work this way?

I can do using Base.Dates or I can Pkg.add("Dates") then do using Dates (without “Base”).


#2

The Iterators module is also available both in Base and as a package.


#3

As explained in https://github.com/quinnj/Dates.jl, this is only for people who want to use Dates in Julia 0.3. In later versions of Julia you can use the built-in Dates module.


#4

Based on the contents of ~/.julia/v0.5/METADATA/Iterators/url that package is found at

https://github.com/JuliaCollections/Iterators.jl

But, unlike Dates, its README.md does not state that it’s provided for compatibility with an earlier version of Julia (nor is any other reasoning given).

Also, in my installation of Julia v0.5 there’s no Base.Iterators - only Base.IteratorEltype, Base.IteratorSize and Base.IteratorsMD. And none of them have the functions provided by https://github.com/JuliaCollections/Iterators.jl


#5

Right, the Base.Iterators package is only in v0.6. In v0.5 there were a few iterator functions (e.g. product) directly in Base, which were moved into the Base.Iterators package for v0.6. I actually don’t (but would be interested to) know what the long-term plan for this package is in relation to the external Iterators package.


#6

Side note: some things are missing from Base.Iterators like chain. Is that on purpose?


#7

Despite providing similar functionality for some functions, the Iterators module in Base and the Iterators package are barely related. Base.Iterators contains only the iterators needed to implement Base functionality.