The Language Reference & Guide
- Welcome to Emojicode
- Syntax
- The Basics
- Literals
- Variables and Assignment
- Control Flow
- Classes & Value Types
- Overloading
- Operators
- Optionals
- Errors
- Inheritance and Overriding
- Protocols
- Enumerations
- Types and Namespaces
- Types as Values
- Documentation
- Generics
- Callables
- Packages
- Threads
- Safe and Unsafe Code
- Memory Management
- References
- Appendix: The Emojicode Compiler
Documentation
Documentation is an important part of writing good code. Emojicode therefore offers built-in tools to document your code.
Documentation Comments
Emojicode supports a special type of comments which are called Documentation Comments. The syntax is:
documentation-comment βΆ π documentation-comment-characters π
documentation-comment-characters βΆ οΏ’π unicode | documentation-comment-characters
package-documentation-comment βΆ π package-documentation-comment-characters π
package-documentation-comment-characters βΆ οΏ’π unicode | package-documentation-comment-characters
Documentation comments can only occur at specific locations:
Before a class, value type, enum or protocol declaration:
π Protocol defining random-access. Types representing a collection whose elements can be accessed by π½ randomly should conform to this protocol. The number of elements must be finite and returned by π. π π π π½οΈπElementβͺοΈπ π
Before a method, type method or initializer declaration:
π Gets the item at *index*. If the index is invalid the behavior is up to the conforming type. π βοΈ π½ index π’ β‘οΈ Element
Before an enumeration option:
π Indicates a generic error. π π π΄
In packages a π documentation comment can be used to add documentation about the whole package:
π Emojicodeβs standard library. π
Although there is, of course, no obligation to do so, these comments traditionally use Markdown. All packages that ship with Emojicode are documented this way and are automatically compiled into the Package Index of this documentation.
The compiler furthmore offers an option to create a JSON report about a package, including all documentation added with documentation tokens. To learn more about this see Appendix: The Emojicode Compiler.