Skip to content

AhdCode v1.8.0

Choose a tag to compare

@aliharundaldalli aliharundaldalli released this 19 Sep 07:30
· 18 commits to main since this release

AhdCode v1.8.0 — GUI Foundations + Minimal Events — adds a small GUI
module for desktop windows, click and key callbacks for GUI windows and
Graphics Canvases, and readable output for five value Classes. The core
grammar, the static type system, and every previously released function keep
their v1.7.0 behaviour.

GUI

bring GUI opens real desktop windows with a deliberately small set of
widgets:

  • GUI.window(title, width, height) returns a Window; window.column() or
    window.row() creates its single root Container.
  • A Container adds a Label, a Button, a single-line TextInput, a
    Checkbox, and nested Columns and Rows, with spacing and padding.
  • text()/setText, checked()/setChecked, setTitle, close,
    isOpen, and wait — the whole surface.
  • Invalid sizes, spacing, a second root Container, or changes to a closed
    Window raise GUIError; nothing is silently clamped.
  • Text is drawn with the bundled Go Regular font, so Turkish and other
    Unicode text looks the same everywhere; no font is downloaded.

GUI is meant for learning and small desktop applications — forms, data-entry
tools, simple database front ends, and utilities. It is not Tkinter or Qt,
not a game engine, not a full desktop widget framework, and not an
application packager. There are no tables or grids, list boxes, drop-downs,
menus, dialogs, file pickers, scrolling, themes, or resizable windows; file
pickers, table-style widgets, and application packaging remain future work.

Events

  • Button.onClick(handler) takes a () -> Nothing Function and
    Window.onKey(handler) a (key: String) -> Nothing Function.
  • Graphics gains Canvas.onClick(handler) with (x: Real, y: Real) in the
    Canvas's Cartesian coordinates (origin at the center, +y up) and
    Canvas.onKey(handler), so a Turtle can be steered with the arrow keys
    without reading the terminal.
  • Handler shapes are checked at compile time. Registering again replaces the
    previous callback.
  • Callbacks run during wait(), one at a time, on the program's own path of
    execution; a long callback blocks its window.
  • A callback's error closes the window and leaves wait() unchanged — a
    ValueError stays a ValueError. GUIError and GraphicsError are only
    for GUI and Graphics failures.
  • Key names: ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Enter,
    Escape, Space, Tab, Backspace, Delete, Home, End, PageUp,
    PageDown, A–Z, and 0–9, key-down only. There is no polling,
    key-up event, or frame loop.
  • Canvas.wait() without callbacks behaves exactly as before.

Runtime

  • Each Window is drawn by one process of the new bundled ahdgui helper,
    built with the same pinned window library as ahdgraphics (Ebitengine
    v2.10.2). The helpers exchange bounded JSON lines with the program, with
    separate routing for responses and events and a bounded event queue.
  • Helpers close with the program that opened them, and they are started by
    their absolute path; PATH is never searched.
  • wait() writes out everything the program printed before it, so text
    appears in the terminal while a window is open.
  • The ahdgui helper runs no shell command, uses no network, reads no files
    or environment files, and does not log what a user types.

Readable values

str, write, and Terminal.pretty now show the contents of first-party
values instead of only their Class name, for example Vector([3.0, 4.0]),
Matrix([[1.0, 2.0], [3.0, 4.0]]), DateTime(2026-09-19T10:00:00.000+03:00),
Duration(1500 ms), and Table(["id", "name"], [["1", "Ada"]]).
Terminal.emit still accepts only a List<String>, and there is no
reflection or general object dump.

Language and tooling

  • No grammar, type-system, or coercion change, and no Any, dynamic typing,
    or reflection.
  • Compiled programs, ahdcode run, and the REPL share one implementation.
  • Editors get completion, hover, and signature help for every new function
    and member, including the callback types.

Examples and documentation

examples/v1.8 holds simple_ledger (a GUI form that validates an entry and
stores it with SQLite) and turtle_events (a Turtle driven by arrow keys and
clicks). The new GUI reference, the Graphics "Clicks and key presses" section,
language specification sections 83 and 84, and student guide section 65 are
available in English and Turkish, and ahdcode init web projects receive the
v1.8.0 documentation.

Compatibility

A v1.7.0 program compiles and behaves the same, except that str and write
of a Vector, Matrix, DateTime, Duration, or Table now print its contents
instead of <Vector>-style Class names.

Known limitations

  • On macOS the menu bar shows the helper's name, ahdgui, while a Window is
    focused.
  • Window.onKey also receives keys typed into a focused TextInput.
  • Windows cannot be resized, and a long callback blocks its window.

Downloads

File Platform
AhdCode-1.8.0-macos-arm64.pkg macOS Apple Silicon — recommended installer
AhdCode-1.8.0-macos-arm64.dmg macOS Apple Silicon — drag-install image
AhdCode-1.8.0-macos-arm64.zip macOS Apple Silicon — archive with install.sh
AhdCode-1.8.0-windows-x64.exe Windows x64 — graphical per-user setup
AhdCode-1.8.0-linux-x64.tar.gz Linux x64
ahdcode-0.2.3.vsix VS Code extension (own version line, unchanged)

The macOS .pkg and .dmg are signed with Developer ID certificates,
notarized by Apple, and stapled. The Windows installer is not Authenticode
code-signed; SmartScreen may show an unknown-publisher warning.

Platform QA

  • macOS (Apple Silicon): live-tested from the release ZIP in an isolated
    prefix: real GUI windows with Unicode typing, Checkbox, Button callbacks,
    and arrow/Enter/Escape keys; the Turtle example with real arrow keys, clicks,
    and PNG/SVG saving; and a compiled GUI program that found its helper on its
    own. The same checks ran offline and headless under ahdcode run and as
    relocated native programs with identical output.
  • Linux x64: structural and package checks only; the artifact and its GUI
    were not run on a Linux machine for this release.
  • Windows x64: structural and package checks only, including the setup's
    embedded payload test; the artifact and its GUI were not run on a Windows
    machine for this release.

SHA256SUMS.txt lists the checksum of every artifact.