Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

47
LINES

< > BotCompany Repo | #1028956 // Loaded Standard Functions

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (12970L/68K).

!7

concept FunctionDef {
  S functionName;
  S snippetID;
}

cmodule LoadedStandardFunctions > DynCRUD<FunctionDef> {
  transient Map<S, Class> loadedBlobs = syncMap(); // snippetID -> main class
  transient S status;
  
  start {
    dbIndexing FunctionDef('functionName);
    updateStatus();
  }
  
  visual centerAndSouth(super, withLeftRightAndTopMargin(dm_centeredLabel status()));
  
  Class getBlob(S _snippetID, S forFunction) {
    S snippetID = fsI(_snippetID);
    Class _blob = loadedBlobs.get(snippetID);
    if (_blob != null) ret _blob;
    ret dm_evalInQ(() -> {
      Class blob = loadedBlobs.get(snippetID);
      if (blob == null) {
        print("Hotwiring " + snippetID + " for function " + forFunction);
        loadedBlobs.put(snippetID, blob = hotwireDependent(snippetID));
        updateStatus();
      }
      ret blob;
    });
  }
  
  void updateStatus {
    setField(status := n2(loadedBlobs, "loaded blob"));
  }
  
  // API
  
  ObjectPlusMethodName getFunction(S name) {
    FunctionDef def = conceptWhere FunctionDef(functionName := name);
    if (def == null) null;
    O blob = getBlob(def.snippetID, name);
    if (blob == null) null;
    ret ObjectPlusMethodName(blob, name);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028956
Snippet name: Loaded Standard Functions
Eternal ID of this version: #1028956/6
Text MD5: 86ee8801a97913c2a90588b8fb65bb9d
Transpilation MD5: 8439787d9d7ea5c7e690d7e04d9a2e01
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-13 23:44:39
Source code size: 1265 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 552
Version history: 5 change(s)
Referenced in: #1028957 - dm_loadedStandardFunctions