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

Why SFX?

The Problem with Traditional Programming

For 50 years, programming languages have taught us lies that have become “normal”:

  • “Don’t worry that 0.1 + 0.2 ≠ 0.3, you’ll get used to it”
  • “Arrays start at 0 because… reasons”
  • “Null pointer exceptions are just part of programming”
  • “Emoji taking 7 characters is technically correct”

These aren’t features - they’re historical accidents that have become normalized.

The SFX Philosophy

SFX takes a different approach: Programming should match human intuition, not computer architecture.

“Programming the way humans think, not the way computers think”

1. Mathematical Honesty

The Problem:

// JavaScript, Python, Java, C++, etc.
0.1 + 0.2  // 0.30000000000000004 ❌

The SFX Solution:

Result is 0.1 + 0.2
Print Result  # 0.3 ✓

SFX uses arbitrary precision arithmetic by default. Math works the way you learned in school.

2. Human-Friendly Indexing

The Problem:

# Most languages
items = [10, 20, 30]
first = items[0]  # Why 0? Humans count from 1!

The SFX Solution:

Items is [10, 20, 30]
First is Items[1]  # First item is 1, naturally!

3. No Null Pointers

The Problem:

// Java - the billion-dollar mistake
String name = null;
name.length();  // NullPointerException! 💥

The SFX Solution:

# All types have safe defaults:
# Numbers → 0
# Strings → ""
# Booleans → False
# Lists → []
# Maps → {}

# For optional values, use Option type:
Result is Some(42)
NoResult is None

If Result.IsSome:
    Value is Result.Unwrap()

4. Grapheme Clustering

The Problem:

# Python, JavaScript, etc.
emoji = "👨‍👩‍👧‍👦"
len(emoji)  # 7 ❌ (Why? It's ONE emoji!)

The SFX Solution:

Emoji is "👨‍👩‍👧‍👦"
Length is Emoji.Length  # 1 ✓ (One emoji = one character)

5. Reactive Programming

The Problem:

// Manual updates everywhere
class Product {
  constructor() {
    this.price = 0;
    this.tax = 0;
    this.total = 0;
  }

  setPrice(price) {
    this.price = price;
    this.updateTax();      // Don't forget!
    this.updateTotal();    // Don't forget!
  }

  updateTax() {
    this.tax = this.price * 0.1;
    this.updateTotal();    // Don't forget!
  }
}

The SFX Solution:

Concept: Product
    Price, Tax, Total

    # Automatic - no manual updates needed!
    When Price changes:
        Set This.Tax to This.Price * 0.1
        Set This.Total to This.Price + This.Tax

6. Context-Oriented Programming

The Problem:

// Traditional OOP - behavior is fixed
class User {
  String getPermissions() {
    return "read";
  }
}

// To change behavior, you need inheritance, decorators,
// or manual if-checks everywhere

The SFX Solution:

Concept: User
    To GetPermissions:
        Return "read"

Situation: AdminMode
    Adjust User:
        To GetPermissions:
            Return "admin,write,delete"

Story:
    Create User Called Bob
    Print Bob.GetPermissions  # "read"

    Switch on AdminMode
    Print Bob.GetPermissions  # "admin,write,delete"

Design Principles

1. Beginner-Friendly

SFX is designed for people learning to program:

  • Natural syntax: Name is "Alice" instead of name = "Alice"
  • Clear keywords: Repeat 10 times instead of for(i=0; i<10; i++)
  • No surprises: Math works correctly, lists start at 1, no null crashes

2. Powerful When Needed

Despite being beginner-friendly, SFX has advanced features:

  • JIT Compilation: 2-5x automatic speedup
  • Concurrency: Tasks and channels
  • Networking: HTTP, WebSocket, TCP, UDP
  • LLM Integration: Built-in OpenAI support
  • Reactive Observers: Self-healing data

3. No Legacy Baggage

SFX was designed in 2024, not 1970. We don’t have to maintain backwards compatibility with mistakes from 50 years ago.

Who is SFX For?

Perfect For:

  • Beginners learning to program
  • Educators teaching programming concepts
  • Rapid prototyping where correctness matters
  • Business logic with financial calculations
  • Scripts and automation that should “just work”

Maybe Not For:

  • Systems programming (use Rust, C)
  • Embedded systems with tight memory constraints
  • High-frequency trading where microseconds matter (though JIT helps!)
  • Large legacy codebases (migration would be significant)

The “AI Era” Design

SFX is designed for the AI era where:

  1. LLMs write a lot of code - SFX’s natural syntax is easier for AI to generate correctly
  2. Correctness matters - When AI generates financial calculations, 0.1 + 0.2 should equal 0.3
  3. Rapid iteration - JIT compilation means you get interpreter speed + compiler performance

Comparison

FeatureSFXPythonJavaScriptJava
Math correctness
1-based indexing
No null crashes
Grapheme-aware
Reactive observers
Context-oriented
JIT compilation
Easy concurrency~~~

Getting Started

Ready to try programming without the lies?


Programming should be intuitive, not historical.