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

Glossary

The documentation uses abbreviations, language terms and a set of terms with exact meanings in this project. An abbreviation links to the reference that defines it, and a language term to the section of the walkthrough that introduces it. A project term has no outside reference, so it is defined here, with a pointer to the page that treats it in full.

Abbreviations

AbbreviationMeaning
ABIApplication binary interface: names, calling convention and struct layouts at the machine level; Keyrill’s is include/keyrill.h
ADRArchitecture decision record; Keyrill’s are in docs/adr
APIApplication programming interface
ARCAutomatic Reference Counting: retain and release inserted by the Objective-C compiler
ASanAddressSanitizer, clang’s memory-error detector
BOMByte order mark, U+FEFF at the start of a text file
CC BY-SACreative Commons Attribution-ShareAlike 4.0, the license of the model’s word data
CIContinuous integration; here, the GitHub Actions workflows in .github/workflows
COMComponent Object Model, the Windows object system TSF is built on
DLLDynamic-link library, a Windows shared library
EWTEnglish Web Treebank, one of the evaluation corpora
FFIForeign function interface: calling between Rust and another language; here, the crate keyrill-ffi
GCDGrand Central Dispatch, Apple’s queue library
GTKGTK, a toolkit for Linux desktop applications
HRESULTA Windows status code returned by COM methods
IMKInputMethodKit, the macOS framework for input methods
IPCInter-process communication; every IMK client call is one
MSVCMicrosoft’s C and C++ toolchain, and the Rust Windows target that uses it
RAIIResource acquisition is initialization: a C++ object whose destructor undoes what its constructor did
SHA-256A cryptographic hash; used to pin the model source and the corpora, for consistency rather than authenticity
TISText Input Sources, the Carbon API that lists and selects keyboard layouts and input methods; see Terms
TSFText Services Framework, the Windows counterpart of IMK
TUIText-based user interface, such as a program running in a terminal
UBSanUndefinedBehaviorSanitizer, clang’s undefined-behavior detector
UDUniversal Dependencies, the treebank project the evaluation corpora come from
UTF-8, UTF-16UTF-8 and UTF-16, Unicode encodings; every length in the ABI counts UTF-16 code units
X11The X Window System, the older Linux display protocol

Language terms

The terms the walkthrough sets in bold, with the section that introduces each.

TermMeaning
AccessorA getter or setter method; an Objective-C property declares a pair
AppKitThe part of Cocoa for windows, menus and events
ARCAutomatic Reference Counting: the Objective-C compiler inserts the retain and release calls
AtomicA variable whose reads and writes are indivisible even across threads
AttributeAn annotation for the Rust compiler, written #[...], or #![...] for a whole crate
BlockObjective-C’s closure, written ^{ ... }
Borrow checkerThe part of the Rust compiler that enforces the rules for references
CallbackA function handed to other code for it to call later
Calling conventionWhich registers and stack slots carry a function’s arguments and result
CaptureA closure or block keeping a variable from the code around it
Class methodAn Objective-C method called on the class itself, declared with +
ClosureAn anonymous function that can use variables from where it was written
CocoaApple’s Objective-C frameworks for macOS applications
Compile time, run timeWhile the compiler translates the program, and while the program runs
Constructor, destructorThe C++ functions that run when an object is created and when it is destroyed
CrateRust’s unit of compilation: one library or one program, compiled as a whole
Data raceTwo threads touching the same memory, at least one writing, without coordination; undefined behavior
Debug build, release buildThe unoptimized build for development, and the optimized one that ships
Dependency injectionHanding a function its collaborators instead of letting it reach for them
DropDestroying a Rust value when its owner goes out of scope
EditionA per-crate dialect of Rust: 2015, 2018, 2021 or 2024
Enum, variantA Rust type that is one of several variants, each with its own fields
FakeA working stand-in for a real dependency, written by hand for tests
FuzzerA tool that feeds a program generated and damaged inputs
Garbage collectorThe part of Python’s or JavaScript’s runtime that frees objects nobody refers to
GenericCode written once for many types; the Rust compiler makes a copy per type
GuardIn a match, a condition after if; for a mutex, the value that holds the lock and releases it when dropped
HandleA value that identifies an object to code that can’t see inside it
HeaderA C file of declarations that other files include
Heap, stackMemory for data of unknown size or lifetime, and memory for a function’s local variables
InitializerAn Objective-C method that sets up a new object, the counterpart of a constructor
Input methodA program between the keyboard and applications that decides what text a key produces
Input sourceThe macOS name for a keyboard layout or input method chosen from the menu bar
Instance variableA private field of an Objective-C object, declared in @implementation
Internal linkageA name visible only inside its own source file
IteratorA source of values produced one at a time, on demand
LifetimeThe name, written 'a, for how long a borrowed reference stays valid
LinkerThe tool that joins compiled files into one program by matching symbols
LintA check for a suspicious pattern, at level allow, warn, deny or forbid
Lock, mutexLets one thread at a time into the code or data it protects; a Rust Mutex contains its data
MacroCode the compiler expands into more code; in Rust its name ends in !
Main thread, main queueThe thread on which macOS delivers every input event, and the queue that runs blocks on it
ManglingEncoding a function’s context or parameter types into its symbol name
Message, selectorA method call looked up by name at run time, and that name, such as handleEvent:client:
ModuleA Rust namespace, usually one file
MoveHanding a Rust value to a new owner; the old variable can’t be used afterwards
Nested run loopThe event loop entered again from inside a call that is waiting
Opaque typeA struct with a name and no definition, which code can point to but not look inside
OwnerThe variable or field that a Rust value belongs to
PanicRust stopping on a bug; it unwinds the stack unless the build aborts instead
Pattern, armA shape a value is compared against, and one branch of a match
ProcessA running program
PropertyAn Objective-C declaration of a getter and setter, written by the compiler
Property testA test that checks a law over many generated inputs
ProtocolA named list of methods any Objective-C class may adopt
Queue, serial queueA GCD list of blocks to run; a serial queue runs them one at a time, in order
RAIITying an action to a C++ object’s lifetime, so its destructor undoes it on every exit
Raw pointerA plain memory address with no lifetime and no guarantee it is valid
ReentrancyCode entered again before its first run has finished
ReferenceAccess to a value without owning it: &T shared, &mut T exclusive; in C++, another name for an object
Retain count, retain cycleThe number of owners of an Objective-C object, and two objects that own each other and so are never freed
Run loopThe main thread’s event loop in a macOS program
SeedThe starting value of a random generator; fixing it makes a test repeat exactly
ShrinkingA property-test tool reducing a failing input to a small one
SliceA view of part of an array: a pointer and a length
Standard libraryThe library every Rust program gets with the compiler
Static libraryA file of compiled code the linker copies into a program
Struct, fieldA record of named fields
SymbolThe name a function or variable has in compiled code
Tagged unionA value that is one of several variants and records which
ThreadAn independent sequence of execution inside one process
TraitA named set of methods a Rust type can provide
Translation unitOne source file with every header it includes, compiled as one unit
Undefined behaviorAn operation the language gives no meaning to; the program may crash, corrupt memory or seem to work
UnsafeRust code in which a person vouches for what the compiler can’t prove
UnwindingLeaving each function in turn and cleaning up, as an exception or panic propagates
UTF-16 code unitOne 16-bit value of UTF-16 text; most characters take one, some take two
WorkspaceThe set of Rust crates built together from one root Cargo.toml
WorktreeA second checkout of the same Git repository in another directory

Terms

Acknowledgement. The adapter’s report of what happened to a plan, through kr_commit: verified, refused before the write, or unknown. Only a verified acknowledgement advances the Rust session. See Rust in the core.

Adapter. The platform code that owns the native objects and the editing: on macOS, the Objective-C++ under native/macos. It calls the engine through the C ABI and never the other way round. See macOS adapter.

Boundary. The context in which a letter may start a word: the caret at the start of the document or after whitespace, read back from the client. Anything else, including a prefix that couldn’t be read, is ineligible, and the letter goes to the application untouched.

Boundary mark. A word and its Space, still marked after Space so that a correction can be undone by replacing Keyrill’s own mark. It ends with the next key. ARCHITECTURE.md calls the state BoundaryRetained.

Compatibility backend. The macOS backend for applications that can’t hold an owned composition, such as terminals: it posts synthetic key events and treats them as dispatched, never as verified edits. It is the one exception to owned-composition-only editing; see ADR 006.

Controlled-native evidence. A result from the native tests, which run the real adapter and the real Rust engine against a scripted fake client. It shows what the adapter does on a schedule; it shows nothing about a real application, which only a physical test can. See Testing.

Explicit intent. A manual conversion or a reversal by the user. It stops automatic inference for the rest of that word, so inference never undoes a choice the user made.

Fixture policy. A test policy that converts exactly ghbdtn and руддщ and nothing else, so that session tests don’t depend on the model.

Generation. A counter that grows on every event invalidating what the adapter knows. An operation remembers the generation it started under and compares after each native call; a difference means a callback ran in between, and the operation stops. See Reentrancy and tests.

Guard. The compatibility backend’s listen-only event tap. It observes mouse, navigation, shortcut and source changes without reading characters; each one ends tracking and advances the process-wide guard generation, which every rewrite rechecks before it posts. See macOS.

Inference. The engine’s decision, at a word boundary, whether a finished word was typed in the wrong layout. It uses the frozen model, the user’s dictionaries and recent context, and leaves the word alone whenever it is unsure. See Engine.

Input mode. Keyrill EN or Keyrill RU, the two input sources Keyrill installs; the mode decides which layout the keys type in.

Learned words. Words the user taught the OS spell checker. They protect and forbid words like the Vim dictionaries, but automatic correction never waits for them.

Local authority. The adapter’s record of the mark it verified last: the client, the start offset and the exact text. A write needs it, and the adapter drops it before every write and regains it only when the write’s checks pass, which for a mark update means a matching readback.

Mark, owned composition. Marked text, the underlined composition of an input method, that Keyrill itself placed with setMarkedText and still owns. It is the only text the composition path may change; the compatibility backend is the one exception. See How Keyrill works.

Plan. Rust’s answer to one key: an id, one permitted action (pass, mark, finish or unavailable), the text the mark must hold before the write, the text to write, and what to do with the key afterwards. A plan is a proposal, never editing authority.

Poisoned handle. An engine or vocabulary handle in which a Rust panic was caught. Every later call on it returns KR_POISONED; only freeing it remains. See The C boundary.

Provisional key. A key such as [ or ; that types punctuation in English but a Russian letter in Russian. In English mode it may start or continue a word, because the word may turn out to be Russian typed in the wrong layout.

Readback. Reading the composition back from the client after a write, over exactly the range written. It is the only evidence of a write’s effect that the adapter accepts; an API’s success return is not. The one write verified without it is an unchanged commit that IMK or the controller requests, which writes back the text last verified in the mark; see the edit contract.

Receipt. The text a word had before Keyrill first converted it, kept while the same word is owned so that Control-Option-Z or Escape can restore it. An edit or finishing the word expires it.

Secure Input. The macOS mode in which keyboard input goes only to the focused application, used for password fields (TN2150). While it is on, Keyrill passes every key and inspects nothing.

Snapshot. An immutable, fully parsed copy of a dictionary, published whole as an Arc and never edited in place. A failed parse leaves the last good snapshot in force.

Tier. How Keyrill handles one application, chosen by its bundle identifier: composition, compatibility (automatic and manual, or manual only) or off. See macOS adapter.

TIS. Text Input Sources, the Carbon interface in HIToolbox/TextInputSources.h (functions named TIS...) that lists, enables and selects input sources. Apple documents it only in that header. Keyrill uses it to list input sources and read their properties and to observe source changes, and avoids it where its answers are unreliable inside the input method’s own process (Input-source switching).

Unknown outcome. The acknowledgement for a write that was attempted but whose effect couldn’t be verified. It invalidates the session and stops correction; nothing is repaired or replayed. The edit contract lists the one write still allowed afterwards and when correction resumes.