murarth / ketos

Lisp dialect scripting and extension language for Rust programs
Apache License 2.0
751 stars 45 forks source link

Doc-strings for methods #17

Closed hauleth closed 8 years ago

hauleth commented 8 years ago

It would be cool to allow defines to be written like that:

(define (foo a b c)
  "Documentation string"
  (+ a b c))

This would be great step into making Ketos fully usable language for real development (no need for documentation generator yet).

murarth commented 8 years ago

Personally, I prefer a more Rust-like doc comment form:

;; Documentation
(define (foo) ...)

The tokenizer detects these comments (Vim syntax highlighting, too), but I haven't gotten around to writing a ketosdoc utility.

hauleth commented 8 years ago

That is somewhat an idea, but docstrings in code has one advantage in Lisps - documentation is part of the code. Which mean you can generate docstrings with macros or work with it like any other piece of language. Also notation with docstrings is de facto standard in Lisp world (AFAIK).

murarth commented 8 years ago

That's a good point. Can't argue with that. The doc comment syntax can be sugar for docstrings, anyway. I'll get started implementing this pretty soon.

murarth commented 8 years ago

Docstrings have been implemented in afe930caed38e47f53cdf4b5f48acff3879cf7ea.