# Where is the documentation for "validargs"?

**URL:** <https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093>\
**Category:** New to Julia\
**Tags:** documentation\
**Created:** [December 29, 2018, 5:11pm UTC](https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093 "2018-12-29T17:11:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juan/32/7657_2.png) [@Juan](https://discourse.julialang.org/u/Juan)\
**Post date:** [December 29, 2018, 5:11pm UTC](https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093/1 "2018-12-29T17:11:38Z")

</div>

I was reading the documentation for _Functions_ and found this

> **[Functions · The Julia Language](https://docs.julialang.org/en/v1.0/manual/functions/#man-functions-1)**
>
> Documentation for The Julia Language.

## [Optional Arguments](https://docs.julialang.org/en/v1.0/manual/functions/#Optional-Arguments-1)

```julia-auto
function Date(y::Int64, m::Int64=1, d::Int64=1)
    err = validargs(Date, y, m, d)
    err === nothing || throw(err)
    return Date(UTD(totaldays(y, m, d)))
end

```

But I can’t find any further information about the _validargs_ function.

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [December 29, 2018, 5:15pm UTC](https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093/2 "2018-12-29T17:15:50Z")

</div>

Seems like that code example snippet could be simplified to remove some of the unrelated content there. Something like:

```julia
function Date(y::Int64, m::Int64=1, d::Int64=1)
    return Date(ymd_to_utd(y, m, d))
end

```

---

<div class="post-metadata">

**Author:** ![Juan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juan/32/7657_2.png) [@Juan](https://discourse.julialang.org/u/Juan)\
**Post date:** [December 29, 2018, 9:59pm UTC](https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093/3 "2018-12-29T21:59:48Z")

</div>

> [@Juan](#):
>
> validargs

But what is the function “validargs”?

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [December 29, 2018, 11:20pm UTC](https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093/4 "2018-12-29T23:20:28Z")

</div>

`validargs` does not exist. It is just used for the example. As Jameson points out, it is not even relevant and can be safely ignored.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 30, 2018, 7:34am UTC](https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093/5 "2018-12-30T07:34:30Z")

</div>

> [@00vareladavid](#):
>
> `validargs` does not exist.

It does, it just isn’t exported.

```julia
julia> Dates.validargs
validargs (generic function with 3 methods)

```

> [@Juan](#):
>
> But I can’t find any further information about the _validargs_ function.

```julia
help?> Dates.validargs
  validargs(::Type{<:TimeType}, args...) -> Union{ArgumentError, Nothing}

  Determine whether the given arguments consitute valid inputs for the given type. Returns either an ArgumentError, or nothing in case of success.

```

But this is incidental, the example just demonstrates optional arguments, and the line checking them could be removed.

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [December 30, 2018, 7:37am UTC](https://discourse.julialang.org/t/where-is-the-documentation-for-validargs/19093/6 "2018-12-30T07:37:19Z")

</div>

Thanks for clarifying, I should have grepped through the codebase before I made that claim. Next time 😁
