h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
311 stars 23 forks source link

Help Symbol #85

Closed ghost closed 3 years ago

ghost commented 3 years ago

A symbol that helps about what symbols do we get expections from. Yes THAT is help. If it was exist, we could use it for symbol documentation maybe.

I am saying again: I don't want to do hack in Min via try symbol. Because expection errors contains expection info.

h3rald commented 3 years ago

Sigh... I knew this was gonna happen. I agree 100%, and you are right of course!

Technically this is very easy to implement, but practically it would also mean a complete rework of the existing site, because of course I would want to write the documentation only in one place!

h3rald commented 3 years ago

Currently working on a help system. Actually, it is already implemented in next for user symbols and sigils, that means you could start documenting your own symbols and sigils like this:

 (
   symbol plus
   (num :m num :n ==> num :result)
   (m n + @result)
 )
 ;; Sums two numbers m and n.

...then you can do:

 ?plus

...and you get:

 === plus [symbol]
 (num :m num :n ==> num :result)

 Sums two numbers m and n.

Note that if you don't provide a description you still get name, kind, and signature.

Then... well, the hard thing is going to be provide the same help text for all native symbols, which are all written in Nim 😞 -- I will write a min script to process the existing site docs and load it in he executable.

Note that you have to use doc comments (either ;; or the new block syntax #|| ... ||#) to document operators.

h3rald commented 3 years ago

Implemented, including docs for all native symbols.