Welcome to Fin# (Financial Sharp / finsc)
Fin# (Financial Sharp, .fin) is RaggieSoft Labs' open-source (MIT License), linear-type double-entry financial programming language and .NET compiler blueprint where the First Law of Thermodynamics is enforced on money at compile time.
Why Imperative Languages Fail Accounting
In mainstream imperative languages—C#, Java, C++, Python, TypeScript, and imperative spreadsheet macros—monetary balances are represented as ordinary unconstrained scalar numbers (decimal, BigDecimal, or worse, binary double).
In an unconstrained scalar language, the following line compiles with zero warnings and zero errors:
// Standard imperative code: compiles cleanly even though $500,000,000.00
// just materialized out of thin air without debiting any counterparty account!
companyRevenue += 500_000_000.00m;
Even when engineering teams apply strict code reviews and Sarbanes-Oxley (SOX Sections 302 and 404) controls, scalar languages only discover unbalanced postings, dropped sub-cent rounding remainders, or accidental cross-currency additions at runtime or months later during a forensic audit.
Fin# catches them in milliseconds at compile time.
The Five Compile-Time Conservation Laws of Fin#
| Invariant | Compiler Diagnostic | What finsc Proves Before Emitting Code |
|---|---|---|
| 1. No Thin-Air Mutation | FIN0001 | Scalar +=, -=, =, or un-paired account writes outside an atomic transaction block are rejected immediately. |
| 2. Balanced Double-Entry | FIN0002 | Every transaction block proves Luca Pacioli's 1494 identity (∑ Debits ≡ ∑ Credits) per currency. |
| 3. Zero Binary Floating-Point | FIN0003 | IEEE 754 float and double cannot touch Capital<T>, Rate<A, B>, or Account<K, T>; all math is 128-bit scaled fixed-point. |
| 4. Dimension-Typed Currencies | FIN0004 | Capital<USD> and Capital<EUR> cannot be mixed without an explicit fx.convert(...) clearing bridge. |
| 5. Linear Remainder Safety | FIN0005 | Capital<T> is a linear resource (Move-only: no Copy, no silent Drop). Unallocated split remainders fail compilation! |
60-Second Tour: Your First .fin Ledger
Here is the real-world scene from The Eleventh Child—recording a $30.00 annual aquatic center keytag pass on Geneva Street—written in idiomatic Fin#:
// geneva_household.fin — Every cent is conserved at compile time!
ledger GenevaHousehold412 [currency: USD, audit_standard: Z_SOX_302] {
account OperatingChecking : Account<Asset, USD>;
account WellnessPassPool : Account<Expense, USD>;
account HouseholdEquity : Account<Equity, USD>;
// Explicit external boundary ingress: pairs Asset against Equity
opening_balance(
debit: OperatingChecking,
credit: HouseholdEquity,
amount: 1_250.00_USD,
memo: "August 2015 Fall Semester Opening Balance"
);
// Atomic double-entry transaction: Sum(Debits) == Sum(Credits) == $30.00 USD
transaction PurchaseAquaticKeytag [audit: Z_SOX_302, date: "2015-10-09"] {
let keytagFee : Capital<USD> = credit OperatingChecking -> 30.00_USD;
debit WellnessPassPool <- keytagFee;
}
}
Try deleting debit WellnessPassPool <- keytagFee; in PurchaseAquaticKeytag:
- First,
finsc checkraisesFIN0005(UnconsumedLinearCapitalError) becausekeytagFee(Capital<USD>) reached the end of its scope without being consumed into a destination account. - Second,
finsc checkraisesFIN0002(UnbalancedJournalEntryError) because the transaction has30.00_USDin credits and0.00_USDin debits!
Open-Source Licensing & RaggieSoft Ecosystem
- Compiler, SDK & Tooling Code: 100% Open Source under the MIT License (
https://raggiesoft.dev& GitHub@raggiesoft). - Documentation & Literary Origins: Licensed under Creative Commons Attribution-ShareAlike 4.0 International (
CC BY-SA 4.0). - RaggieSoft Reference Portal (
v0.8.0): Just like raggiescript.raggiesoft.dev, finsharp.raggiesoft.dev is a three-column RaggieSoft Reference Portal compiled from plain-text.rshp+ Markdown sources by RaggieSoft Help Studio (rshbuild.exe)—generating this searchable web reference, itsCtrl+Kinstant API index, its offlineFinSharpHelp.exeviewer,llms-full.txt, and its WCAG 2.2 AA VPAT 2.5 report from one build!