Fin# (Financial Sharp) v0.1.0
Browse Table of Contents (6 chapters)
Getting Started (2)
Language Specification (2)
Compiler & Standard Library (1)
Diagnostics & Proofs (1)
Master Symbol Index
4 min read Module: raggiesoft.finsharp F1: IDH_FIN_WELCOME (0x3001)

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#

InvariantCompiler DiagnosticWhat finsc Proves Before Emitting Code
1. No Thin-Air MutationFIN0001Scalar +=, -=, =, or un-paired account writes outside an atomic transaction block are rejected immediately.
2. Balanced Double-EntryFIN0002Every transaction block proves Luca Pacioli's 1494 identity (∑ Debits ≡ ∑ Credits) per currency.
3. Zero Binary Floating-PointFIN0003IEEE 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 CurrenciesFIN0004Capital<USD> and Capital<EUR> cannot be mixed without an explicit fx.convert(...) clearing bridge.
5. Linear Remainder SafetyFIN0005Capital<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:

Open-Source Licensing & RaggieSoft Ecosystem