Ph0enixKM / Amber

💎 Amber the programming language compiled to bash
https://amber-lang.com
GNU General Public License v3.0
3.51k stars 67 forks source link

Comment doc block #237

Open Mte90 opened 4 days ago

Mte90 commented 4 days ago

So right now we have tons of function in stdlib.

Can be handy to document them in the file itself, in this way the documentation can generated aautomatically. So I was thinking something for that.

In Amber looking at the doc there is no way right now for commenting, so we need to choose what is the best way.

Rust uses /** like PHP (https://doc.rust-lang.org/reference/comments.html), python instead use """the sentence""".

b1ek commented 4 days ago

i think we should use /// and /** */ for doc strings to be consistent with rust

also we should think through tags like this:

/**
    @return It will return none if has failed
*/
async fn get_user() -> Option<User> { ... }
b1ek commented 4 days ago

id say we go with these:

tag desc
@return {desc} is used to describe a function's return value
@param {paramName} {desc} is used to describe a function's param
@author {name} is used to describe the author
@license {SPDXID} to describe the license
Mte90 commented 4 days ago

Seems the best way, maybe with https://docs.rs/comment-parser/latest/comment_parser/ we can implement easily?