Skip to content

v3.0.0

Latest

Choose a tag to compare

@tinchodias tinchodias released this 03 Nov 05:41

This release comes four months after v2.9.0. Under semantic versioning, it is a major version bump reflecting significant host API and space lifecycle refactorings. Most of these changes include automated deprecation rewrites to ensure a smooth migration (detailed below).

Functionally, the most significant addition is a new concurrency and space synchronization model (settle, deferAndSettle:, defer:). Two new guides accompany these changes, covering concurrency, synchronization, and responsive UI patterns: Concurrency And Synchronization and Building Non-Blocking UIs. The README has been restructured to guide readers through these topics in a cohesive narrative.

The primary target for this release is the recently released Pharo 14.

Brief Migration Guide:
The table below outlines common migration patterns. Note that automated deprecation rewrite rules are provided for most of them:

Old Pattern New v3.0 Pattern Rationale
space pulse space settle #pulse is deprecated; senders cannot force pulses, only wait for the host pulse process to settle.
space show space open Preferred idiomatic space opening method (matching #close). #show is retained as a compatibility alias.
element forceLayout (when attached) space settle or space deferAndSettle: Prevents layout races against the active host pulse loop.
space useSDL2Host / useSDL3Host space useSDLHost Unified SDL host selection across versions and platforms.
space host: BlOSWindowSDL2Host new space host: BlSDLHost default Automatically selects SDL2 or SDL3 according to current OSWindowDriver. Sending #new is deprecated in favor of #default.
space host: BlMorphicWindowHost new space host: BlMorphicWindowHost default Standalone hosts are now singletons. Sending #new is deprecated in favor of #default.
space host: BlHeadlessHost new space host: BlHeadlessHost default Standalone hosts are now singletons. Sending #new is deprecated in favor of #default.
space host: BlMockedHost new space host: BlHeadlessHost default Mocked hosts removed; use headless host on real pulse loop.
space host: aNewHost (while open) space close; host: aNewHost; open Host immutability: spaces must be closed before switching hosts.
element focused element isFocused or element isFocusOwner Distinguishes focus delegation (isFocused) from direct leaf ownership (isFocusOwner).
element focusHolder element focusDelegate #focusHolder is retained as a compatibility alias.
BlTransparentPaint new BlColorPaint transparent Centralized paint caching.

Key Changes

Concurrency & Synchronization Primitives

  • BlSpace Synchronization APIs:
    • space settle: Blocks the active process until all queued tasks, skin phases, and layout computations reach equilibrium. Guarded against execution from within the host pulse process.
    • space deferAndSettle: aBlock: Enqueues aBlock onto the pulse process and blocks the active process until subsequent frame phases settle. Canonical pattern for tests and interactive scripts.
    • space defer: aBlock: Non-blocking asynchronous dispatch to the space's pulse loop (for background worker processes).
    • space deferOrValue: aBlock: Executes inline if already running on the space's pulse process; otherwise enqueues to the pulse loop.
    • space isSettled: Non-blocking query answering whether all frame phases are currently idle.
  • Deadlock Guard (#denyPulseProcess):
    • Raises an explicit error if blocking synchronization (#settle, #deferAndSettle:, waitUntil:) is sent from within the host pulse loop itself, preventing self-deadlocks.
  • Guarded Attached Layout:
    • Guarded BlElement >> #forceLayout against attached elements; attempting to force layout on an attached element raises an error directing senders to space settle or space deferAndSettle:. Detached elements retain synchronous #forceLayout.

Hosts and Universes

  • Singleton Hosts (#default) & BlHostRegistry:
    • Standalone hosts (BlHeadlessHost, BlOSWindowSDL2Host, BlOSSDL3Host, BlMorphicWindowHost) use TBlSingletonHost and are accessed via #default. Sending #new is deprecated with an automated rewrite rule delegating to #default.
    • Dynamic host lifecycle registered in SessionManager (startUp: / shutDown:).
    • BlHost serves as an OOP facade encapsulating universe (#spaces, #closeSpaces, #openSpace:, #closeSpace:).
  • BlParallelUniverse:
    • Opening and closing spaces are queued as synchronized state transitions (spacesToOpen, spacesToClose) under lifecycleMutex, evaluated deterministically during pulse, and guarded with ifCurtailed: transactional state restoration.
    • Zero-cost cancellation: Evaluating space open; close (or space show; close) in the same frame resolves in memory without touching OS windows or GPU contexts.
  • Event-Driven Host Pulse Loop (0ms Wake-on-Demand):
    • Replaced unskippable delay sleeps with pulseRequestedSemaphore waitTimeoutMilliseconds: msToWait. Wakeups on UI interactions happen in 0ms without busy-waiting or process starvation.
    • Consecutive #requestPulse message sends during event bursts are coalesced into a single pulse pass via consumeAllSignals.
    • Pre-signal natural shutdown: When all spaces close, the host marks itself stopped before signaling waiting processes.
  • Host Immutability Invariant:
    • Mutating space host: while a space is open or transitioning is disallowed; spaces must be closed first (or migrated via space migrateToHost:).
  • Removal of BlMockedHost:
    • Removed BlMockedHost and package BlocHost-Mock. Headless testing runs uniformly on the real pulse architecture via BlHeadlessHost default.
  • Zero Dependencies on Beacon:
    • Removed BlParallelUniverseErrorDuringPulseSignal; error handling and semaphore notification are self-contained.

Test Architecture Modernization

  • Introduced BlSpaceTestCase for fast, pulse-synchronized headless unit tests with automated space cleanup.
  • Extracted event simulation into BlEventSimulator (Bloc-Simulation) with stateful modifiers, chainable cascades, and #denyPulseProcess guards.
  • Reorganized test suites by concern: BlParallelUniverseTest (engine), BlSpaceSettleTest (equilibrium), BlSpaceLifecycleTest (windows), BlStartupShutdownTest (persistence), and BlParameterizedHostTest (host matrix).

Morphic Host Modernization

  • Converted Morphic window spaces to run on a dedicated pulse process (matching SDL2 and SDL3 hosts).
  • Implemented double-buffering (backBuffer, frontBuffer) in BlAbstractMorphicHostSpace, preventing tearing and blank frames in Morphic / Spec2 presenters (SpBlSpaceInMorphPresenter, BlDemoPresenter).
  • Fixed initial 0@0 extent issues via synchronous morphicWindow fullBounds in BlMorphicWindowHostSpace >> #show.

Focus Management & Delegation

  • Focus Query Clarification:
    • Added #isFocusOwner to query whether an element is the active focus leaf in the space (self space focusOwner == self).
    • Clarified #isFocused to honor focus delegation via #focusDelegate using identity matching (== self).
    • Optimized #hasFocus to walk the space's O(depth) focused element path instead of an O(N) full tree traversal.
    • Deprecated private #focused with an automated rewrite rule targeting #isFocused.
  • Focus Delegation (#focusDelegate):
    • Introduced #focusDelegate (retaining #focusHolder as a backward-compatible forwarder) to model composite elements where an outer container delegates user focus to an inner editor leaf.
    • Simplified BlFocusProcessor to interact directly with space.
    • Added unit test coverage for focus delegation across all BlFocusability modes (after, before, block).

Optional SDL3 Support

Support for SDL3 has been prepared with BlOSSDL3Host and BlOSSDL3GPUHost alongside existing SDL2 hosts. SDL3 is an optional integration requiring PharoSDL3 (v0.4.0+). GPU-accelerated rendering through SDL3 should be treated as experimental until end-to-end driver validation is finalized.

Pull Requests

New Contributors

Full Changelog: v2.9.0...v3.0.0