Julia: Better documentation standards for optional arguments

Created on 1 Sep 2016  路  5Comments  路  Source: JuliaLang/julia

I believe we need better standards for documenting optional arguments. In the manual I sometimes see it as

foo(arg [,optional_arg])

So maybe we need to have that for all optional arguments in the help docs, instead of the often ambiguous

foo(arg, [optional_arg])

That latter maybe confused for an array.

doc docsystem

Most helpful comment

I think we should stop using square brackets for this and favor using the actual Julia syntax for optional inputs most places. If there are multiple signatures not implemented via trailing defaults, we can just list the signatures on separate lines.

All 5 comments

Currently, the only reference is the manual: http://docs.julialang.org/en/latest/manual/documentation/ It advises the f(x[, y]) form, but that's quite recent so the existing docstrings don't really follow this rule.

An issue is that it's quite heavy when there are several optional arguments: f(x[, y[, z]]). Not sure what to do about it.

I think we should stop using square brackets for this and favor using the actual Julia syntax for optional inputs most places. If there are multiple signatures not implemented via trailing defaults, we can just list the signatures on separate lines.

Might work. One would need to go over Base and see how it looks in practice.

Duplicate of #4902.

Close as dup?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TotalVerb picture TotalVerb  路  3Comments

m-j-w picture m-j-w  路  3Comments

StefanKarpinski picture StefanKarpinski  路  3Comments

wilburtownsend picture wilburtownsend  路  3Comments

sbromberger picture sbromberger  路  3Comments