Hi.

Sorry if this is obvious or belies a complete misunderstanding of the Julia way… but I was trying to figure out how to do argument checking in a user defined type. For example, to enforce that a value be a positive valued number.

As a relative beginner (a Matlab convert) I didn’t really know how to do this. The closest I got in searching the documentation was that it should be done as a constructor, so I need some kind of function in my user defined type.

I managed to find an example from Distributions.jl where you define a normal distribution, where sigma has to be positive

```
struct Normal{T<:Real} <: ContinuousUnivariateDistribution
μ::T
σ::T
Normal{T}(μ, σ) where {T} = (@check_args(Normal, σ > zero(σ)); new{T}(μ, σ))
end
```

So this is pretty opaque to me as a beginner, and it seems like `@check_args`

is a macro specific to the Distributions.jl package?

I also found that there is the ArgCheck.jl package which looks promising. But my hunch is that there should be a way of doing this with base Julia.

Anyway, I guess my friendly point here is that as a beginner approaching this pretty routine task I didn’t really get very far. If anyone could point me towards an example, or provide an answer, that would be cool. My hunch is that quite a lot of newcomers to Julia would probably appreciate a little worked example in the docs.