Tillbaka
· 2 min lästid
One way to do each thing
Each thing a Balaur game does has one spelling: four naming principles, an audit of 985 script API items, and what moved into Balaur Script.
- Dragos Balaur
Each thing a Balaur game does has one spelling. Four principles pick the name, and the compiler names the form to write.

Names
docs/NAMING.mdholds four principles: use the words the reader knows, one word for one meaning, one shape of name for one kind of thing, and a name that says what the call site cannot.scripts/api_lints.pyholds the script API to them,house_lints.pythe Rust side andstring_lints.pythe words.
One spelling
- An audit of every item a game can reach counted 985 over 50 modules. It found 56 second spellings: 27 in physics, 10 in UI and input, 8 in the kernel, 6 in audio and the network, and 5 in rendering.
- One spelling of each stays, and every caller uses it. The
panelwidget kind is the one left, for its caption and nine-patch plate. ui::edit(node, value)sets a slider, a swatch, a fold or a field by the value's type.scene::root().get_node(path)is the one path lookup.- The compiler refuses a second spelling of a nil test, an
anyread or a cast, and names the one to write. - Each of the 88 rapier and parry wrappers runs from a script in a test.
Into Balaur Script
- Balaur Script has bit operators and
text.bytes(). Base64 of 1 MiB takes 6 to 15 ms in the prelude, against 38 to 46 ms as a host call. quat, fivegeometry2dhelpers,random::uuidandaudio::play_fileare prelude scripts too. Saves are the library'ssaveaddon.- What stays native was measured first.
hash::sha256_filetook 13.3 to 20.4 ms a MiB as a script, against 0.75 to 0.88 ms. - Tile collision on a 256 by 256 map retired 16 times the native build's instructions as a script. A
timerscript on each of 1000 nodes retired 8.9 million a tick, against 44 thousand.