Skip to content

Latest commit

 

History

History
207 lines (139 loc) · 6.67 KB

index.md

File metadata and controls

207 lines (139 loc) · 6.67 KB

Kinx Specification

As A Sample Of SpecTest

Overview

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.

As an example of SpecTest, I prepared another here.

How to Run

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

Contents

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.

Command Line

Here is a command line specification.

Statement

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.

Basic Statement

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

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.

Block
Branch

By the way, Kinx has supports a case-when, and the syntax of case-when is described in expression because it is an expression.

Loop
Jump

Definitions

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.

Object Definitions

Special Objects

Type Check

The following properties are used to check the type of a variable.

Library

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.

Primitives

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.

Functions

Standard Objects

Here are provided objects as a Kinx Standard.

Basic Objects

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.

Network Objects

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.

Exception Objects

Algorithm and Data Structure

Algorithm and Data structure examples are being described in the page below.

Others

Some special specifications.

Bug Fixes