I think you should use the constructors if the user expects to construct
a certain type, e.g. `Dict()`.  Conversely if the user cares about the
action then use a function, e.g.:

julia> keys(Dict())
Base.KeyIterator for a Dict{Any,Any} with 0 entries

here I don't care about the type, I just want to iterate the keys.

But of course, it's not that clear-cut: `linspace` has history, so does
`zeros`.  So, for a new container type I'd use the constructor `FooBar`.

On Sun, 2016-06-19 at 23:12, Gabriel Gellner <[email protected]> wrote:
> I am currently making some container like types, so I am using the
> convention of studly caps for  the types ie `FooBar`. For usage I am
> confused on what the julian convention is for having expressive type
> constructors like for `Dict` and `DataFrame`, versus using methods like
> `linspace`. Clearly I could use either, but it is not clear to me when I
> should use one convention over the other.
>
> Clearly I can have my api be like:
>
> f = FooBar(...)
>
> or
>
> f = foobar()
>
> but is one preferred over the other? Is it just random when to use one or
> the other when making container like types?

Reply via email to