From 77ecbdabe9345f5ea635570d6d01c4e36155104c Mon Sep 17 00:00:00 2001 From: Ge Wang Date: Mon, 9 Dec 2024 12:39:11 -0800 Subject: [PATCH] add @doc example and release notes --- VERSIONS | 18 ++++++++++++++++++ examples/class/inline-doc.ck | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 examples/class/inline-doc.ck diff --git a/VERSIONS b/VERSIONS index 18589a1f8..ff5002d8a 100644 --- a/VERSIONS +++ b/VERSIONS @@ -4,6 +4,24 @@ ChucK VERSIONS log 1.5.4.4 ======= +(added) basic @doc functionality for language-defined classes to add inline + CKDoc documentation for class definitions and function defintions. + ---------------------------------------- + class Foo + { + // add inline documenation (processed at compile-time) + @doc "this is a description for the class Foo" + + fun void bar() + { + // add inline documenation (processed at compile-time) + @doc "a function in Foo, bar() likes calling his friends" + } + } + // can see the above @doc descriptions printed in the class info + // (will also appear in documentation generated by CKDoc) + Foo.help(); + ---------------------------------------- (fixed) crash due to functions / classes references a local variable defined at file-scope; code emission is now internally re-ordered to compile file-scope code segments -> function definitions -> class definitions diff --git a/examples/class/inline-doc.ck b/examples/class/inline-doc.ck new file mode 100644 index 000000000..439da4f4b --- /dev/null +++ b/examples/class/inline-doc.ck @@ -0,0 +1,23 @@ +// show how to add descriptions with classes and functions +// using @doc; descriptions added in this manner are associatd +// with respective classes and functions and will appear in the +// .help() runtime info mechanism, as well as in documentation +// generated using CKDoc. +// +// requires: chuck-1.5.4.4 or higher + +class Foo +{ + // add inline documenation (processed at compile-time) + @doc "this is a description for the class Foo" + + fun void bar() + { + // add inline documenation (processed at compile-time) + @doc "a function in Foo, bar() likes calling his friends" + } +} +// print runtime info about Foo: +// can see the above @doc descriptions in the class info +// (will also appear in documentation generated by CKDoc) +Foo.help();