The Singleton
Ensuring only one Master Control Program rules the WebAssembly linear memory.
β§ GANG OF FOUR LINEAGE & ARCANUM β§
GOF DESIGN PATTERN: Singleton
ARCANUM SCHOOL: Abjuration // Sealing
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// WASM PATTERN //
(module
(global $instance_ptr (mut i32) (i32.const 0))
(func $get_instance (result i32)
(if (i32.eq (global.get $instance_ptr) (i32.const 0))
(then
(global.set $instance_ptr (i32.const 0x1000))
)
)
(global.get $instance_ptr)
)
)
The Singleton
There can be only one Master Control Program dictating the flows of the linear memory. The Singleton seals the instantiation vectors, ensuring that a single, globally accessible pointer rules the WebAssembly dominion, untouched by rogue concurrent invocations.
Runic Tags:
#WASM
#Abjuration
#Master