Function prototypes or documentation #2756
-
|
Hi everyone. I'm using C3 for a toy language implementation, for both the parser/code-gen and the VM. My question is about function prototypes (pre-declaration) and/or documentation. Because right now my "documentation" comments get drowned by all the noise of the function implementations. I noticed there's a future feature "c3c docs", is that potentially what I'm looking for? Thanks for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
The // mylib.c3
module mylib;
import std::io;
fn void some(int x)
{
io::printfn("Hello, World! %s", x);
}
// mylib.c3i
module mylib;
<*
My documentation
param x : "something" // normally this would be <at symbol>param but the github highlighting is a bit broken rn
*>
fn void some(int x);
// somefile.c3
module some;
import mylib;
fn void main()
{
mylib::some(12345);
}$ c3c compile-run somefile.c3 mylib.c3 mylib.c3i
ERROR: function `some` from module `mylib` declared twice.if this is fine with you then you could put your docs in a |
Beta Was this translation helpful? Give feedback.
The
docs/folder in a project is there for a potential future docs generator that uses doc comments or for writing your own docs manually, there isn't anything automatic yet.C3 does have
.c3iinterface files as a parallel to C.hfiles which can be used to put dedicated documentation comments, however they have a few more limitations than in C: they are only intended to be used to interface with precompiled libraries and not for forward declarations, so if you have a.c3ifile that has the same declarations as a.c3they will cause conflicting defitions when compiled together: