Documenting function syntax (*without* using square brackets)

Status
You're currently viewing only sweetpepper's posts. Click here to go back to viewing the entire thread.
Not open for further replies.

sweetpepper

Ars Legatus Legionis
13,247
Subscriptor
Odd question.. I'm a tech writer for a software product and I'm brainstorming ideas for documenting function syntax without using brackets for optional arguments. I tried to search for examples but everything I found seems to use UNIX-style.

Has anyone seen documentation that had an alternate system for indicating optional args?

For instance, right now if we have a function that operates like this:
y,[z] = x(A,[B|C],[D])
(there is a flag in A that lets the function know if B|C and/or D is going to be present, and whether to return z)

we list the combinations like:
y = x(A)
y = x(A,B)
y = x(A,C)
y,z = x(A)
y,z = x(A,...)
y = x(A,...,D)
y,z = x(A,...,D)

and actually, not everyone uses the "...", so sometimes they're all repeated. if B and C are independent, it's even more combinations. which is silly when i can write it in one line if we have something to symbolize "optional" and which ones go together! but in our world the brackets mean something else and we can't use them here. It's published in HTML so we're thinking maybe shading/color would help, like grey out or highlight. maybe multiple colors to indicate dependencies? I actually think angle brackets might be ok.. but getting push back on that because they're also already used (in a separate context, i think the difference is clear but not everyone agrees).

So, what have you seen?
 

sweetpepper

Ars Legatus Legionis
13,247
Subscriptor
yes, it's MATLAB. and therefore, yes, the majority of our customers are non-programmers. the products i personally support are more advanced, and i can rely on them having a programming background, but certainly not across base MATLAB. we're currently solving the problem for a small set of advanced features. i don't know if we will try to spread it to the entire doc. the rest of the language doesn't have this optional-args-enabled-by-flags issue(there are some optional args, but not frequently and not this complex). and i agree colour is tricky, which is why i'm looking for other thoughts.

the table idea.. is maybe useful.. because doc-ing those flags that enable the args is another part of the problem.. we're just brainstorming right now. don't even get me started on why the flags are that way! it's weird. o_O
 
Status
You're currently viewing only sweetpepper's posts. Click here to go back to viewing the entire thread.
Not open for further replies.