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

28
LINES

< > BotCompany Repo | #1033977 // VarContext

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (8370L/47K).

asclass VarContext {
  gettable VarContext parent;

  *() {}
  *(VarContext *parent) {}
  
  abstract O get(S name);
  
  abstract void set aka put(S name, O value);

  abstract AutoCloseable tempSet aka tempPut(S name, O value);
  
  // either undefines variable completely or just sets variable to null
  abstract void unset(S name);
  
  abstract MapSO varMap();
  
  void printMe {
    pnl(varMap());
    print(+parent);
  }
  
  // mechanism for returning from a script
  
  settable O exitFromScript;
  settable O returnValue;
  bool exiting() { ping(); ret exitFromScript != null; }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033977
Snippet name: VarContext
Eternal ID of this version: #1033977/26
Text MD5: cfbc3981bf9971896434ab49f964a933
Transpilation MD5: be01e54574daba568d56f28f797636d6
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-28 22:45:17
Source code size: 618 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 95 / 283
Version history: 25 change(s)
Referenced in: [show references]