coalton-lang / coalton

Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
https://coalton-lang.github.io/
MIT License
1.12k stars 67 forks source link

Add optional docstring for struct fields #1121

Closed Izaakwltn closed 3 months ago

Izaakwltn commented 3 months ago

This adds docstring support for struct fields:

(coalton-toplevel

  (define-struct turtle
    (Shell "Does this turtle have a shell?" Boolean)
    (ThirdEye "Is this actually a terrapin?" Boolean)
    (ShellDensity Double-Float))) ;; docstrings aren't required

fixes #1118

stylewarning commented 3 months ago

Should the doc string come just after the symbol being defined?

Izaakwltn commented 3 months ago

Should the doc string come just after the symbol being defined?

Sure, that would work if that's the preferred.

Izaakwltn commented 3 months ago

Please also add field doctrings to the documentation generator output.

Screenshot 2024-06-06 at 6 20 11 PM
Izaakwltn commented 3 months ago

After this is merged I will make PR's for class method docstrings and type constructor docstrings.

Izaakwltn commented 3 months ago

I added the neglected struct-tests.lisp file to :coalton/tests.