svoid philosophyBot1_addEnableableExtension(PhilosophyBot1 bot, S name, IVF1 enable) { Map> map = cast bot.getExtension("enableableExtensions"); if (map == null) { // first time, register ourselves as an extension bot.addExtension("enableableExtensions", map = new Map); Map> _map = map; bot.addFactPreprocessor(s -> { new Matches m; if "enable extension *" { IVF1 action = _map.get($1); if (action == null) warn("Extension " + $1 + " not found"); else action.get(bot); true; } false; }); } // after that, just add new entry to map map.put(name, enable); }