This is Kinx specification, and examples are test code as is. This is right just a specification document, but this is also test codes at the same time. I named this system as SpecTest, and this documentation is also provided as an example of the SpecTest. Writing a specification means writing a test, and examples will become test codes as is.
As for the detail of SpecTest, that will be described in the link below, but SpecTest is designed to not only for Kinx but also for any other systems. This means you can also use SpecTest for your product developed not by Kinx.
- See SpecTest for detail.
As an example of SpecTest, I prepared another here.
Set and confirm a path to the kinx
and kxtest
executable first.
After that, execute the command below under kinx
repository's root to run the SpecTest of Kinx,
and SpecTest will automatically load a .spectest
file and run the tests.
$ kxtest -v
Actual specification is described from here.
I divided the section for the description of SpecTest, but actually it do not have to be separated.
SpecTest will recognize the test code by the rule of .spectest
file regardless of the structure of document.
Here is a command line specification.
Statement is almost near the C or JavaScript syntax.
There are some of special statements that yield
for Fiber, mixin
for Module, and so on.
A declaration and expression statement is a basic statement of Kinx.
Some of expression rules will be described in expression
section.
mixin
is a special declaration used to include Module
component.
This statement will be described also in Module
section again.
And a declaration of a Function or a Class, etc, is described not in this section but in Definitions section.
Flow control is a branch, a loop, returning from a function, throwing a exception, etc.
But as for function call is described in expression
because it is a part of expression.
Note that a flow is not changed by block
, but block
is included in this section.
By the way, Kinx has supports a case-when
, and the syntax of case-when
is described in expression because it is an expression.
Definitions are structured as a Function definition, a Class definition, and a Module definition. As a special object derived from Function, there are Lambda, Closure, and Fiber.
The following properties are used to check the type of a variable.
Kinx has many useful libraries and you can use those once you install this product. Kinx goal is to become a glue between libraries, and Kinx will include many of useful libraries also in future.
This is not a library but basic methods for a primitive data type, but the description is included in this section because its feature is near a library.
Here are provided objects as a Kinx Standard.
Basic objects are the list of components usually used in many products. The functionality is very simple but powerful, so a lot of developpers will use those naturally.
- System
- Getopt
- Iconv
- Colorize
- Math
- File
- Directory
- Regex
- Enumerable
- Functional
- Range
- DateTime
- Process
- JSON
- CSV/TSV
- Xml
- Zip
- SQLite
- JIT
- Parsek
- Clipboard
- SemanticVersion - V1.1.0
Network library is now very few, but it will be increased in future because now the networking library is needed by many developpers.
I provide Http library only, but it is based on libcurl. Therefore adding a library based on the same technology must be easy. I strongly want contributers. How about you?
Note that the above documents do not have any test code because it is hard to test of networking.
Algorithm and Data structure examples are being described in the page below.
Some special specifications.