Language Features

Smalltalk Semantics

Harding keeps message-passing, lexical blocks, late binding, and non-local returns at the center of the language.

  • everything is an object
  • unary, binary, and keyword messages
  • lexical closures with ^ non-local returns
  • resumable exceptions on a stackless VM
Smalltalk Semantics
3 + 4
dict at: key put: value

findPositive := [:arr |
    arr do: [:n |
        (n > 0) ifTrue: [ ^ n ]
    ].
    ^ nil
]

Modernized Syntax

Harding keeps the Smalltalk model but modernizes the surface syntax.

  • # comments
  • double-quoted strings
  • optional periods at line ends
  • & concatenation
  • comma-separated collection literals
Current Syntax
# comment
greeting := "Hello, " & name
values := #(1, 2, 3)
payload := json{"ok": true, "count": values size}

Dynamic Collection Literals

Array, Table, and JSON literals fit naturally into normal expression flow.

Dynamic Literals
skills := #(user primarySkill, user secondarySkill, "reserve")
profile := #{"name" -> user name, "active" -> true}
payload := json{"skills": skills, "count": skills size}

Current Class Definition Style

Harding now emphasizes canonical derive APIs and direct slot access when you want explicit control.

  • derive:, derivePublic:, and canonical variants
  • :: direct slot and binding access
  • multiple inheritance plus mixins
Current Class Definition
Point := Object derivePublic: #(x, y)

Point>>moveBy: dx and: dy [
    x := x + dx.
    y := y + dy
]

Runtime And Concurrency

Stackless VM

Harding uses an explicit work queue instead of depending on the native call stack.

  • green threads
  • resumable exceptions
  • explicit scheduling

Processes And Synchronization

Use Process, Processor, Monitor, Semaphore, and SharedQueue for cooperative concurrency.

Green Processes
worker := Processor fork: [
    1 to: 10 do: [:i |
        i println.
        Processor yield
    ]
]

worker suspend.
worker resume.

monitor := Monitor new.
monitor critical: [ shared := shared + 1 ]

queue := SharedQueue new.
queue nextPut: "item".
item := queue next.

sem := Semaphore forMutualExclusion.
sem wait.
sem signal

Processes remain inspectable at runtime through the scheduler and process APIs.

Web And Reactive Rendering

MummyX Web Support

Harding can build reactive server-rendered web apps using MummyX, a fast scalable native multithreaded HTTP server, the Html DSL, and HTMX-style fragment responses.

  • MummyX request handling on green workers
  • Html DSL rendering
  • HTMX fragment and out-of-band updates
Router + HTMX Response
Router post: "/todos/@id/toggle" do: [:req |
    repository toggle: (req pathParam: "id").
    req respondFragment: panel oob: page statsOobHtml
]

Html DSL + HTMX

The HTML side stays just as small and keeps HTMX concepts visible in the markup.

Html DSL Button
Html render: [:h |
    h section: [:panel |
        panel id: "todo-panel".
        panel button: [:button |
            button class: "btn";
                post: "/todos/1/toggle";
                target: "#todo-panel";
                swap: "outerHTML".
            button text: "Mark done"
        ]
    ]
]

Reactive Cache Invalidation

The active web model uses tracked reads and writes rather than older Html template-hole machinery.

  • TrackedValue
  • TrackedList
  • RenderCache
  • RenderEntry
Reactive Rendering Model
Component render
  - reads tracked state
  - registers dependencies
  - reuses cached HTML if clean
  - re-renders when tracked writes mark entries dirty

Reflection, Dispatch, And Runtime Tools

Reflection And Dynamic Dispatch

Harding supports dynamic messaging and runtime inspection when you need it.

Reflection
obj perform: #description.
obj perform: #at: with: 5.
obj perform: #at:put: with: 5 with: "value".

Point superclassNames.
obj class.
obj slotNames.
obj respondsTo: #do:

Super Sends And Class-Side Methods

Harding supports both class-side methods and qualified or unqualified super sends.

Class-Side And Super
Person class>>newNamed: aName [
    | p |
    p := self new.
    p name: aName.
    ^ p
]

ColoredRectangle>>area [
    ^ super area + colorAdjustment
]

Live REPL

The interactive REPL is still a first-class part of the development workflow.

REPL
$ harding
harding> 3 + 4
7

harding> numbers := #(1, 2, 3, 4, 5)
#(1, 2, 3, 4, 5)

harding> numbers collect: [:n | n * n]
#(1, 4, 9, 16, 25)

JSON Literals

Use json{...} for direct JSON creation and object serialization configuration for API work.

External Libraries

Install packages with harding lib and ship native Nim code together with matching Harding .hrd sources.

Bona IDE

Launcher, Workspace, Transcript, Browser/Inspector work, and an Application Builder workflow.

Granite

Compile Harding code to native binaries through Nim and C toolchains.

Collections

Harding includes arrays, tables, sets, intervals, and the classic collection protocol.

Collections
numbers := #(1, 2, 3, 4, 5).
scores := #{"Alice" -> 95, "Bob" -> 87}.

numbers do: [:n | n println].
squares := numbers collect: [:n | n * n].
evens := numbers select: [:n | (n % 2) = 0].
sum := numbers inject: 0 into: [:acc :n | acc + n]

Granite Compiler

Compile Harding code to native binaries through Granite.

Granite
granite compile myprogram.hrd -o myprogram
granite build myprogram.hrd --release
granite run myprogram.hrd

Harding source -> AST -> Granite -> Nim -> C toolchain -> native binary

Debugging Tools

Use log levels, AST output, and scheduler inspection to understand running programs.

Debugging
harding --loglevel DEBUG script.hrd
harding --ast script.hrd