Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstrings for class/actor members #106

Closed
mfelsche opened this issue Oct 13, 2017 · 6 comments · Fixed by #115
Closed

Add docstrings for class/actor members #106

mfelsche opened this issue Oct 13, 2017 · 6 comments · Fixed by #115

Comments

@mfelsche
Copy link
Contributor

Optionally allow docstrings for class/actor fields below or above the field definition.

class MyClass
  """class docstring"""

  let number: U32 = 1
  """field docstring below"""
  
  fun method(arg: String): None =>
    """method docstring"""
    None
class MyClass
  """class docstring"""

  """field docstring above"""
  let another_number: U32 = 1
  
  fun method(arg: String): None =>
    """method docstring"""
    None

I would like your opinion on this. Maybe a kind of a vote, No, Above or Below?

@Theodus
Copy link
Contributor

Theodus commented Oct 13, 2017

I prefer the first option

@jemc
Copy link
Member

jemc commented Oct 13, 2017

The second option has potential to have confusing edge cases when you didn't include class/actor-level docs.

I'm not opposed to the first option, and I do think it's parseable in theory.

@SeanTAllen
Copy link
Member

Definitely the first. The 2nd is confusing.

@mfelsche
Copy link
Contributor Author

I also thought putting it right after the type and before the optional assignment but this resulted in much more confusing code imo.

Just for demonstration purposes:

let field: String """docstring""" = "value"

let another_field: U8
"""
docstring
"""
= 0

@mfelsche
Copy link
Contributor Author

I am nonetheless also open for the solution of the docstring right after the type and before the optional assignment. If this is what you prefer.

@peterzandbergen
Copy link

In the go language all documentation is before the item being documented.

What I know about docstring is that it is after the item, so I'd opt for the first option, more consistent so less to remember.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants