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).

1  
asclass VarContext {
2  
  gettable VarContext parent;
3  
4  
  *() {}
5  
  *(VarContext *parent) {}
6  
  
7  
  abstract O get(S name);
8  
  
9  
  abstract void set aka put(S name, O value);
10  
11  
  abstract AutoCloseable tempSet aka tempPut(S name, O value);
12  
  
13  
  // either undefines variable completely or just sets variable to null
14  
  abstract void unset(S name);
15  
  
16  
  abstract MapSO varMap();
17  
  
18  
  void printMe {
19  
    pnl(varMap());
20  
    print(+parent);
21  
  }
22  
  
23  
  // mechanism for returning from a script
24  
  
25  
  settable O exitFromScript;
26  
  settable O returnValue;
27  
  bool exiting() { ping(); ret exitFromScript != null; }
28  
}

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: 182 / 400
Version history: 25 change(s)
Referenced in: [show references]