Zig: add documentation for `pub`

Created on 16 Nov 2018  路  2Comments  路  Source: ziglang/zig

docs

Most helpful comment

I think we should have a section for every keyword, at least. We could use for example "Keyword: pub" to make it searchable.

In general it's OK to repeat things in the docs. When communicating to humans, repetition in the right context is often helpful.

All 2 comments

While going through the docs, I found about pub here

https://github.com/ziglang/zig/blob/master/doc/langref.html.in#L3138-L3140

// The pub specifier allows the function to be visible when importing.
// Another file can use @import and call sub2
pub fn sub2(a: i8, b: i8) i8 { return a - b; }

Do you think this is enough?

After trying the hello world program, I searched the document for pub to learn about it, but could not find the above part due to lot of pub statements in the doc.

image

A link to a pub section might seem useful for beginners here 鈽濓笍 . Should we just add a pub section and update the link here? (but then we will be repeating the same thing already told)

I think we should have a section for every keyword, at least. We could use for example "Keyword: pub" to make it searchable.

In general it's OK to repeat things in the docs. When communicating to humans, repetition in the right context is often helpful.

Was this page helpful?
0 / 5 - 0 ratings