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

Inline class/condition documentation #20

Open
aartaka opened this issue May 10, 2023 · 1 comment
Open

Inline class/condition documentation #20

aartaka opened this issue May 10, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request question Further information is requested

Comments

@aartaka
Copy link

aartaka commented May 10, 2023

We already have a documentation shortcut in define-generic, allowing documentation after the initial generic declaration:

(define-generic add ((a integer) (b integer) &key coerce-to-fixnum &allow-other-keys)
  "Adds A and B, coercing them to fixnum if the sum is too big."
  (if coerce-to-fixnum
      (coerce (+ a b) 'fixnum)
      (+ a b)))

This usefully expands to the proper :documentation option of defgeneric.

This inline syntax would be useful in define-class/define-condition*, and is exemplified by Nyxt's define-mode already:

(define-mode annotate-mode ()
  "Annotate document with arbitrary comments.
Annotations are persisted to disk, see the `annotations-file' mode slot.

Commands are:
- `annotate-current-url' and `annotate-highlighted-text' to create
  annotations.
- `show-annotation' and `show-annotations' to show the annotations
  unconditionally.
- And `show-annotations-for-current-url' to show the ones associated with the
  current page."
  #|...|#)

Would be nice to make it native to define-class for even more brevity and ease of use. The downside is that the signature becomes less exact.

@aartaka aartaka added documentation Improvements or additions to documentation enhancement New feature or request question Further information is requested labels May 10, 2023
@Ambrevar
Copy link
Member

Good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request question Further information is requested
Development

No branches or pull requests

2 participants