From: Thomas Walker Lynch Date: Tue, 10 Mar 2026 17:53:12 +0000 (+0000) Subject: doc additions X-Git-Url: https://git.reasoningtechnology.com/%5B%5E?a=commitdiff_plain;h=refs%2Fheads%2Fcore_developer_branch;p=Harmony doc additions --- diff --git a/developer/document/RT_code_format.html b/developer/document/RT_code_format.html index 4f6c3d2..7f2de0c 100644 --- a/developer/document/RT_code_format.html +++ b/developer/document/RT_code_format.html @@ -13,7 +13,7 @@ @@ -144,7 +144,7 @@

The CLI vs. work function pattern

- To avoid the "String Trap" — where logic is tightly coupled to the terminal and requires string serialization to reuse — executable modules must separate the Command Line Interface from the core logic. + To avoid the "String Trap" (where logic is tightly coupled to the terminal and requires string serialization to reuse) executable modules must separate the Command Line Interface from the core logic.

+

Automated formatting tools

+

+ To ensure consistency without manual drudgery, the Harmony skeleton provides a dedicated code formatter called RTfmt. A person can find this tool in the shared/tool/ directory. +

+ +

The RTfmt CLI

+

+ RTfmt is a shallow-tokenizing formatter written in Python. It parses source code into structural blocks (strings, comments, commas, and enclosures) without needing a full Abstract Syntax Tree. This architecture allows it to safely enforce RT formatting rules across multiple languages while preserving indentation and protecting native operators. +

+ + +

Emacs integration

+

+ For Emacs users, the RTfmt.el file provides the RTfmt-buffer interactive command. +

+

+ This wrapper passes the current buffer through the RTfmt pipe command. It automatically detects Lisp-derived modes to append the --lisp flag. Furthermore, it utilizes a non-destructive buffer replacement strategy. This ensures that a programmer's cursor position, selection marks, and window scroll state remain anchored exactly where they were before the formatting occurred. +

+

Exercises

Exercise 1: Comma and function call formatting

Reformat the following C code snippet to strictly adhere to the RT code format rules.

@@ -197,7 +220,6 @@
  • A variable holding multiple absolute file paths for images: imageFiles
  • -
    diff --git a/developer/document/Single-file_C_modules_and_namespaces.html b/developer/document/Single-file_C_modules_and_namespaces.html index c05225e..23af5f8 100644 --- a/developer/document/Single-file_C_modules_and_namespaces.html +++ b/developer/document/Single-file_C_modules_and_namespaces.html @@ -2,7 +2,7 @@ - Single-file C modules and namespaces + C modules, namespaces, and the build lifecycle