Implementing Singletons in Verse
#define the global class
global := class<varies><concrete>():
var MaybeMainDevice : ?main_device = false
#create the global instance
Global : global = global{}
#function that makes it easier to access the device without checking if the option has a value
GetMainDevice():main_device =
if(MainDevice := Global.MaybeMainDevice?) then MainDevice else main_device{}
#in your device's OnBegin you need this line:
set Global.MaybeMainDevice = option{Self}
#when you want to use it, you call:
GetMainDevice()