3 ms·
Other Lisps do it that way without a problem: - If the function body starts with a string literal, it is always the doc-string - If that string is the only th
by kleiba 13y ago
Other Lisps do it that way without a problem:
- If the function body starts with a string literal, it is always the doc-string
- If that string is the only thing in the function body, it is also the return value.
- weavejester 13y agoSure, you can conceive of more complex rules to solve the problem, but that's complicating the syntax for little benefit. You can no longer say "The docstring comes before the arguments". You instead have to say something like "The docstring is the first evaluated expression in the function if the expression is a string, unless the function has multiple arities, in which case the docstring precedes the function's arguments and any isolated string expressions in the bodies will be ignored."