Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Changelog

This record lists major changes to the Co (colang) language/compiler by release version. Versioning policy: 0.* = development/test releases, 1.* = official releases, 2.* = bootstrap.

V1.0.0

  • Official release.

V0.7.0

  • class now supports properties: a class member can be defined as a property via an accessor pair — int a { get { return _a; } set { _a = value; } }; reading obj.a / writing obj.a = x uses the same syntax as an ordinary field and dispatches to get / set automatically. Read-only (only get), write-only (only set) and auto-property sugar (int b { get; set; }, where the compiler synthesizes a hidden backing field) are supported; inside an auto-property’s accessor the contextual keyword field reads/writes that backing storage directly (matching C# 14 style). obj.prop++ / -- (prefix / postfix) and compound assignment obj.prop += x all expand correctly as “read, modify, write”; a property has no independent storage address, so taking its address (&obj.prop) is an error.
  • New private keyword + accessor-level visibility: private is explicit sugar (semantically equivalent to omitting public; cross-module visibility is still governed by the single public gate) and may precede members / methods / properties at the top level, the class header, and inside the class body; public and private together on one declaration is an error. Each property accessor can carry its own visibility (e.g. public int a { get; private set; }) — an accessor marked private may be called only inside the class that defines it, and external read/write is rejected per read-only / write-only.
  • Returning an owned class handle auto-retains: a function / method can now directly return a class handle already held by a local variable or member; the compiler adds one reference-count increment, eliminating the previous double-free crash when returning an owned handle. This form was formerly rejected at compile time (“a function returning a class must return an unowned value”) and is now allowed. Read/write of handle-typed properties (whose type is a class) now participates correctly in reference counting.
  • Full type checking of class method bodies: class methods and accessor bodies now receive the same level of checking as function bodies — undeclared identifiers, assignment and argument type compatibility, method-call argument count, unused variable / parameter warnings, missing return in a non-void function, and other issues previously missed in method bodies are now diagnosed with wording and line/column positions aligned to clang (previously an undeclared name in a method body slipped through to a bare undefined symbol at link time).
  • Fix a class of compile-time misrejections in aggregate initialization: when a struct is partially initialized with a string literal for a char array and later members follow (e.g. struct { unsigned char m1[3]; unsigned long m3; } b = { "12" };), and for ordered initialization involving unnamed / zero-width bit-fields, these were previously misjudged as type mismatches and rejected; they are now accepted like clang, with runtime values identical character-for-character. Known limitation: a union whose first member is an unnamed bit-field, and constant placement for a global initializer mixing “bit-field + zero-width bit-field + nested struct”, remain unsupported — such forms give a loud compile error rather than a silent wrong value.
  • winapi.co continues to expand: added the service-control, desktop / window-station, named-pipe, and network-interface-table (GetIfTable2 / MIB_IF_ROW2 / MIB_IF_TABLE2) API families and struct layouts; the total now stands at about 565 Win32 API prototypes and 78 struct / union layouts, with about 12,600 constants (including the full winerror.h error-code mirror).

V0.6.1

  • winapi.co constants greatly expanded: Win32 constants grow from a few hundred to roughly 12,600, including a full mirror of the winerror.h error codes (7416 entries, line-by-line against Windows SDK 10.0.26100.0 shared\winerror.h) and the user32 window / message / style, CommCtrl common-control, edit-box / menu / scrollbar / tray / hotkey families. Every entry was verified against SDK 10.0.26100.0 with 0 wrong values.
  • winapi.co fixes 18 mismatches with the SDK: 14 function prototypes’ return / parameter types (e.g. SetLastError returns void, CreateSemaphoreW returns HANDLE, GetAsyncKeyState returns SHORT), 1 constant value (IDC_NO), and 3 struct layouts (LOGPEN rewritten per SDK, MODULEENTRY32W field names, WSADATA.szSystemStatus length); before these fixes, calling these APIs could silently pass wrong arguments or read wrong values.
  • [[subsystem("windows")]] can now be written at the top of a source file (application scope): previously the attribute only took effect when attached to the main / WinMain function; it can now be written as a standalone directive at the top level of a .co file, so a Windows GUI program can be produced from the directive plus import and top-level bare code — the “minimal Windows GUI example” in the docs (file-level [[subsystem("windows")]] + import * from winapi; + bare MessageBoxA) now works. It takes effect only in the main module; the attribute in an imported module is ignored with a warning.
  • winapi.co internal restructure (transparent to users): the monolithic winapi.co is split into an umbrella trio (winapi.co + internal parts winapi_core.co / winapi_winerror.co) merged back via #include text inclusion — existing import … from "winapi.co" is unchanged and keeps working, with no user code needing modification.

V0.6.0

  • C _Complex support (core slice): .c / .co now support the float _Complex / double _Complex types, + - * / arithmetic, == != comparison, the constant I (_Complex_I), and the <complex.h> accessors creal / cimag / conj / cabs / carg / projection (with f variants). This batch is a core slice: transcendental functions such as cexp / clog / csqrt and the standalone _Imaginary type are not yet supported; int _Complex is an error when written; __STDC_NO_COMPLEX__ remains defined, so portable code that relies on it to skip complex behaviour is unchanged.
  • Linker errors now report the source location: link-time undefined symbol previously always pointed at <obj>:1:1 with no source line; each undefined symbol is now resolved back to the real call-site file, line and column (falling back to the old form only when it cannot be located).
  • <threads.h> adds the C11 timed functions: thrd_sleep / mtx_timedlock / cnd_timedwait are now provided; and <threads.h> now includes <time.h>, so struct timespec is directly visible without the user including the header themselves.
  • Fix duplicate public global declarations in one module making consumers read the initial value: previously, declaring the same public global variable twice in one .co module split the module-internal instance from the exported one, so consumers read the initial value (0) instead of the latest; the two declarations now resolve to a single instance.

V0.5.4

  • ptr - ptr pointer difference fixed to 64 bits: subtracting two pointers was truncated to a 32-bit int, so a span over 2 GiB came out negative or wrong; it now returns a 64-bit value like clang, and sizeof(p - q) is corrected from 4 to 8.
  • Referencing a public struct no longer crashes: when a public struct had a member type not marked public, the importing compiler used to crash outright; it now gets the size correctly and reports a clear error only when expanding the non-exported member’s fields. Member types referenced by a public struct should still be marked public.
  • math.h adds declarations for copysign, nan, nextafterf and 2 more (5): these lacked prototypes, so calls were treated as returning an integer and silently produced wrong values; they are now declared and compute correctly.
  • float.h adds C23 floating-point feature macros: new macros such as FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, FLT_EVAL_METHOD and FLT_HAS_SUBNORM (9 in total) for feature detection.
  • #if now compares unsigned values correctly: u-suffixed constants and unsigned values over 32 bits were evaluated as signed inside #if, giving wrong results (e.g. #if 2147483648u > -1 tested false); this now matches clang and tests true.
  • winapi.co constants corrected: 6 wrong values fixed (among them STD_INPUT_HANDLE / STD_OUTPUT_HANDLE / STD_ERROR_HANDLE were misaligned, so GetStdHandle(STD_OUTPUT_HANDLE) got the wrong handle) and 6 names that do not exist in the SDK removed. Code using these constants will change behaviour.

V0.5.3

  • The top-level type aliases in winapi.co are now usable across modules: 36 aliases — DWORD / WORD / BYTE / BOOL / HANDLE / HWND / LPARAM / WNDPROC and the rest — were not marked public, so even after import * from winapi; they still produced use of undeclared identifier (and variables declared with those aliases were cascaded into the same error). All 36 are now public typedef, so imported names can be declared and used directly. Behaviour change to note: these names now take part in cross-module same-name detection — if the imported module and the importing side each declare a typedef or a tag with one of these names, they clash.
  • Calling a non-public function across modules is now a compile-time error: calling a function that another module defines with a body but did not mark public used to compile fine and then fail at link time with a bare undefined symbol: X (no source position); it is now rejected at compile time with cannot import non-public symbol 'X' plus source context for the offending line. The rule covers only functions that have a body and are not public; non-public pure declarations such as [[lib]] / external C library prototypes are still allowed.
  • Argument-count checking tightened (now including external API declarations): previously only functions with at least one parameter and a body were arity-checked. From this release, hand-written external API prototypes (no body) and zero-parameter functions int f() / int f(void) are checked too and report too many arguments / too few arguments — they used to pass silently and emit the call with the wrong arguments (mismatched registers/stack; when a [[lib]] import hit a real export, even linking succeeded). setjmp(env) is exempt by name (its setjmp.h prototype takes 2 parameters, and the compiler injects the second).
  • Function prototype semantics now follow C23 (() is equivalent to (void)): an empty parameter list is a zero-parameter prototype, and the whole legacy “non-prototype declaration” compatibility rule set is removed. void f(void); void f(int); is now a declaration conflict; void f(); void f(int a) { … } (previously accepted) is now rejected; calling a parameterless f() with arguments now reports too many arguments. K&R-style definitions remain unsupported. Behaviour change to note: code relying on legacy non-prototype declarations turns into compile errors — matching what clang -std=c23 decides.
  • public typedef struct X Y; now has complete types inside non-root modules: after importing the module, sizeof(Y) / a local Y y; used to be falsely reported as incomplete, and p->a member access or an f(Y h) by-value parameter could even crash the compiler (0xC0000005, no diagnostic); using Y inner; as a struct value member failed only in LLVM verification. From this release the five alias forms are fully equivalent to the struct X tag form; genuinely incomplete types are still rejected in the front end with clang-matching diagnostics.

V0.5.2

  • math.h gains the long double maths declarations (all 56 of the C standard family): the l-suffixed functions — asinhl / acoshl / atanhl / sqrtl and the rest — had no declarations at all in math.h. Following the C implicit-function-declaration rule, colang treated an undeclared function as returning int, so the call site read a floating-point result out of an integer register: compilation and linking both succeeded with no diagnostic, while the program produced garbage integers (which could even differ from run to run). This release adds all 56 l-suffixed declarations, each prototype taken verbatim from the Windows UCRT header (including the host-specific spellings: nexttowardl’s second parameter is long double, ilogbl returns int, lrintl/lroundl return long, llrintl/llroundl return long long, and scalblnl’s second parameter is long). Correctness fix: code that called these functions and received wrong values now receives the right ones.
  • New minimal complex.h: #include <complex.h> used to fail outright because the standard library shipped no such header. This release delivers complex.h, which defines __STDC_NO_COMPLEX__ per the C standard (honestly reporting that complex support is absent). colang still does not implement the _Complex / _Imaginary types, and this header deliberately does not define I — defining I as a real number would let 1.0 + 2.0 * I silently evaluate to 3.0 (a wrong value with no diagnostic at all); sources that really use complex constructions still get explicit diagnostics instead of degrading into real arithmetic. Programs that merely include the header without using complex constructs now compile and run normally.

V0.5.1

  • Warning-diagnostic classification system landed: added the command-line flags -Werror (promote warnings to errors) and -Wno-<group> (silence a specific warning by group name); every warning is now trailed by its group tag [-Wxxx], so they can be toggled precisely.
  • Several clang -Wall / -Wextra warnings added: new -Wunused-variable, -Wunused-function, -Wunused-but-set-variable, -Wswitch (an enum switch that does not cover all enumerators and has no default), and -Wunused-parameter, each verified case by case against clang; also fixed a bug where a warning was emitted twice for a call to a forward-declared function with no body.
  • Bit-field and integer-width diagnostic conformance: spellings that were previously accepted silently — bit-field widths, _BitInt / wchar_t unit widths, redefinition in the same scope, and for / if / switch init-statement scopes — are now all rejected with clang-matching wording and line/column positions.
  • Major winapi.co expansion: on top of V0.5.0 it adds process/thread enumeration, Shell/clipboard/process operations, Hook/keyboard/mouse input, resource loading/power/user name, synchronization objects/memory-mapped files/named pipes, file attributes/volume information/security tokens, heap/process times/handle duplication/IO control, priority/console/environment strings/symbolic links/disk space, console mode / VirtualQuery, registry enumeration/deletion, and named sync objects/waitable timers/heap operations/page locking, among others; the module now totals about 481 Win32 API prototypes, 72 struct/union layouts and 815 constants. Every struct layout was verified line by line against Windows SDK 10.0.26100.0 via sizeof / offsetof.

V0.5.0

  • long / unsigned long in .co sources is now 8 bytes (Windows target); long and long long are now the same type. .c / .h are unchanged and still follow the target data model (4 bytes on Windows / 8 on Linux). Three migration consequences: ① long and long long can no longer both appear in one _Generic; ② taking the address of a .co long variable and passing it to an API prototype declared with int / unsigned int (winapi.co follows the SDK spellings and never uses long) is now rejected as incompatible pointer types; ③ printing a 64-bit integer requires %lld — %ld reads only 4 bytes and yields a wrong value.
  • winapi.co constants corrected and expanded (every one of the 509 constants in the section was re-verified numerically against Windows SDK 10.0.26100.0): SM_CXSCREEN 78→0, SOMAXCONN -1→0x7FFFFFFF, FILE_NOTIFY_CHANGE_LAST_WRITE 0x8→0x10, PATCOPY 0x00F00062→0x00F00021 — code using these four constants changes runtime behaviour, since it previously passed wrong values. Also added FILE_NOTIFY_CHANGE_SIZE, SM_CYSCREEN, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN, so locally re-declared stand-in constants can go back to the winapi.co ones.
  • Literal and type-specifier diagnostic conformance: the spellings below were silently accepted, folded to wrong values, or crashed the compiler with no diagnostic at all; they are now all rejected, with message text and line/column positions matching clang case by case: ① truncated exact-width suffixes (1w, 0x1w → invalid suffix 'w' on integer constant); ② signed / unsigned on floating-point types (signed float, unsigned double → 'float' cannot be signed or unsigned); ③ mixed-case suffixes (1lL, 1wB, 1.0lF); ④ illegal digit strings (0b2, 08, 1f); ⑤ a missing exponent digit (1e, 0x1p) and hexadecimal floating constants missing a significand or an exponent (0x., 0x1.5); ⑥ integer literals wider than unsigned long long (18446744073709551616, 0xFFFFFFFFFFFFFFFFFFFF). Valid spellings are unaffected: 1uwb / 1UWB / 0b1010wb, 1.0f / 1.0L, 08.5 / 09e1 and 9223372036854775808 (typed unsigned long long) are still accepted.
  • winapi.co batch XIII expansion and two return-type corrections: corrected SendMessageA’s return type int→long long (SDK returns LRESULT, 8 bytes on x64; the old spelling truncated the high 32 bits of the return value) and RegisterClassA’s return type short→unsigned short (SDK returns ATOM=WORD; window-class atoms always land in 0xC000–0xFFFF and read as negative when taken as short). Added the WNDCLASSW struct, 18 prototypes (user32 CreateMenu/GetMenu/SetMenu/GetSubMenu/EnableMenuItem/RegisterClassW/UnregisterClassW/RegisterHotKey/UnregisterHotKey/LoadStringW; kernel32 CopyFileW/RemoveDirectoryW/GetFileSizeEx/FormatMessageW/LocalAlloc/LocalFree; gdi32 GetTextMetricsW; comdlg32 GetSaveFileNameW) and 37 constants each verified line by line against Windows SDK 10.0.26100.0 (MOD_*/WM_HOTKEY/VK_F1..F4/MF_*/FORMAT_MESSAGE_*/LMEM_*/GENERIC_*/CREATE_*/FILE_*/ERROR_*, etc.), bringing the module to 374 prototypes / 46 struct-union layouts / 546 constants. A “known boundaries” section at the end of winapi.co documents the compiler-layer limits still outstanding for consumers.
  • Windows x64 by-value struct/union ABI fix: the compiler used to lower every by-value struct/union parameter and return to ptr, which does not match the winx64 ABI (aggregates of ≤ 8 bytes must be packed into a single general-purpose register; only larger ones take an implicit byval pointer). colang’s caller and callee sides shared the same lowering so internal calls stayed self-consistent — the mismatch only showed up when calling external Win32 APIs. Now aligned with clang: aggregates whose store size is 1/2/4/8 are lowered to the matching integer scalar (i8/i16/i32/i64) at the signature boundary; larger or non-power-of-two sizes stay as ptr (the correct Microsoft x64 “pass by reference” lowering). WindowFromPoint(struct POINT) behaviour is corrected; SetFilePointerEx(union LARGE_INTEGER) is added to winapi.co; the corresponding item in the “known boundaries” section is flipped to fixed. Remaining boundaries: the 16-byte pure-integer aggregate “two-register” special case, and external APIs with >8-byte aggregates, are still passed by pointer. Non–Windows-x64 targets are unchanged byte-for-byte.

V0.4.1

  • Diagnostics-conformance wave: compile-time errors/warnings and the diagnostic context were realigned with clang and ISO C/C++, converging several silent-wrong-value/misjudgement sites (file-scope bool/integer constant folding now follows “nonzero is true”).
  • Diagnostics: every error/warning now shows the offending line with +/-2 lines of surrounding source and a caret; -fno-diag-context disables it.
  • CLI and source-surface tightening: new -l/--lib to specify external libraries; [[lib]] and class definitions are restricted to .co sources (rejected in .c/.h).
  • Co-layer robustness: fixed the degradation/crash when using a cross-module public struct by value inside an imported module.
  • winapi.co continues to expand: from V0.4.0’s 323 prototypes / 39 struct-union layouts / 396 constants up to roughly 356 prototypes / 45 struct-union layouts / 503 constants, adding the winsock (ws2_32) socket family, the crypt32 string-encoding family, and more.

V0.4.0

  • The class reference type (heap-only + automatic reference counting): instantiation via new, member access via this, instance methods and static members via C::m(); handles are released in reverse frame order when leaving scope, and break/continue/goto path terminations release them correctly.
  • Member and parameter types opened up: primitives, class, struct/union/arrays all work — a struct/union/array member is embedded by value (not reference counted, allocated and freed with its host); a class handle as a parameter borrows (ownership is not transferred), as a member it is owned by the host (assignment takes ownership, the destructor releases cascadingly).
  • The delete statement: forced destruction (bypasses the count — destructor + cascading release + free); the slot is null-ed to prevent a double free; it can also be used to break reference cycles manually.
  • public class: in a single module and under -o *.dll, exports the lifecycle protocols, the instance/static methods and the members.
  • Current boundaries: no inheritance and no virtual functions; a public class in an imported module cannot yet be consumed across modules; reference cycles are not broken automatically (use delete).
  • Major winapi.co expansion: 323 Win32 API prototypes, 39 struct/union layouts and 396 constants, each re-verified against Windows SDK 10.0.26100.0; beyond the window/message-loop/drawing base it now adds dialogs, menus, common controls, tray icons, DWM, PDH, input method (imm32), file-time/directory enumeration and more.
  • Bare tags in the Co layer (C++ style): in .co sources a struct/union/enum variable definition, parameter or sizeof may drop the keyword (Point p;), and a public tag of an imported module may be used bare as well; not enabled for .c, which stays byte-for-byte ISO C.
  • Version strings extended to four segments MAJOR.MINOR.PATCH.Build: the fourth is a build counter increased by a real MSVC rebuild (it resets to zero when the three-segment version changes); -v output and the PE version info of artifacts follow suit.
  • New default settings header include/colang.h: expanded ahead of the main source at compile time (main source only, not for imported modules), for your own global macro definitions.

The last three items above (bare tags, the four-segment version, the default settings header) were already-shipped changes that never got recorded — the first two landed within the V0.3.1 cycle, the third in the V0.3.2 cycle; they are back-filled here.

V0.3.2

  • Built-in resource compiler: parses .rc syntax, supports ICON / BITMAP / RCDATA / STRINGTABLE / VERSIONINFO / ACCELERATORS / DIALOGEX / MENU resource types; output embedded directly into the PE executable (byte-level alignment with rc.exe).
  • Linux cross-compilation & native linking: --target=x86_64-unknown-linux-gnu emits ELF objects; the in-process lld ELF linker provides end-to-end executables; LP64 data model (long=8, void*=8, wchar_t=4) correctly dispatched.
  • Per-module compilation model promoted: each module compiles as an independent closure, cross-module same-name symbols are automatically routed (no collision); qualified access mod.func() / mod.var supported.
  • wchar_t fully target-aware: width and signedness follow target (Win unsigned short 2 bytes / Linux int 4 bytes); wint_t, L'…' overflow judgement, and TC-prefixed characters dispatch correctly.
  • const diagnostics aligned with clang: read-only violations now carry note: … declared const here pointing at the declaration site; new -Wdefault-const-init warning (function-local const objects or those with const members without initializer).
  • DLL production: synthesised DllMain entry carrier, top-level initialisation code driving, public functions written into the export table.
  • Multiple fixes in integer literal type selection, bit-field masking, and dynamic CRT linking.

V0.3.1

  • The winapi.co module: import … from "winapi.co" replaces windows.h, an SDK-verified set of Win32 API prototypes / struct-union layouts / constants; the module grows across releases and totals 323 prototypes / 39 struct-union layouts / 396 constants as of 0.4.0. First introduced covering common GUI APIs for window creation, message loops, drawing and text metrics.
  • Windows GUI programs: the [[subsystem("windows")]] attribute (or defining WinMain) produces a console-less windowed program.
  • Co-layer enhancements: public const int / public struct etc. from an imported module can be used across modules directly; designated initializers support chained designators and anonymous union members.
  • C compatibility: universal character names (\uXXXX) in identifiers; u8/u/U/L prefixed character constants; sizeof(string literal); static_assert in multiple scopes; the [[nodiscard]]/[[noreturn]]/[[deprecated]] attributes.
  • Diagnostics: const read-only enforcement, up-front incomplete-type diagnostics and rejection of non-constant switch case labels, with wording aligned to mainstream compilers.
  • Fixes: two families of runtime crashes caused by global initializers being mis-folded to null.
  • Release package flattened to colang.exe + include/ (no runtime redistributable, no extra configuration); native Linux (WSL) build brought up.

V0.3.0

  • Built-in linker: -c emits a COFF .obj, and the default action links the object into an executable — no dependency on an external clang.
  • Static CRT linked by default: the produced exe ships without requiring the VC runtime to be installed.
  • -o <name>.dll produces a Windows dynamic library: with an export table, and a .lib import library generated alongside the base name.
  • [[lib("user32")]] declares library attribution, with no command-line flag needed.
  • Linking requires a locally installed Windows SDK / VC runtime (auto-located).
  • import (.co source merge) landed:
    • Syntax: import * | name [as alias], … from ("file" | module_name) [as ModAlias];;
    • Consumes .co sources only; public is the sole cross-module visibility gate;
    • Top-level statements run exactly once at first load, unified before the main entry in DFS-postorder topological order;
    • Normalized absolute path dedup; DFS cycle detection reporting the full chain;
    • Identifier form from a is accepted, equivalent to from "a.co" (same directory only).
  • Referencing a non-imported symbol from the main source is rejected; importing a non-public symbol via named or * form is rejected.
  • Non-public imported symbols are forced to InternalLinkage during codegen (no externally-visible LLVM value is emitted).

See the “import (Module Import)” and “Module” chapters for semantics.

V0.2.0

  • Added bare top-level code, public functions, and import support;
  • Added DLL/SO generation;
  • Fixed several issues against the C language test suite.

V0.1.0

A development/test release; the C language compiler is complete.

  • The compiler supports C compilation; Co’s object-oriented and other extensions (such as class) are at the specification/planning stage and are not yet implemented.

V0.0.x

Development/test versions (historical). Features and syntax followed the then-current test versions and are not a release baseline.