A R# scripting runtime context.
Environment
00 Remarks
(在一个环境对象容器之中,所有的对象都是以变量来表示的)
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 4 | run environment initialize: 1. |
| GetSymbolsNames | 1 | get all variable symbol names(function symbol is not included) |
| GetValue | 1 | Try to get value of the specific symbol |
| WriteLineHandler | 1 | a shortcut wrapper function pointer for base.print()) |
| AddMessage | 2 | add error/warning message |
| setStackInfo | 1 | replace current stackframe information |
| FindSymbol | 1 | 这个函数查找失败的时候只会返回空值 |
| FindFunction | 1 | 会首先在当前环境中的符号列表查找函数,如果不是函数则会在当前环境的函数列表中查找 如果当前环境中不存在,则会在父环境中查找符号 |
| Delete | 1 | just removes the symbol reference in the runtime environment |
| AssignSymbol | 1 | do value assign |
| Push | 1 | Variable declare, just add a new symbol in current environment context. |
| asRVector | 1 | |
| EnumerateAllFunctions | 1 | get all function symbols based on the environment context lineage to the root environment |
| EnumerateAllSymbols | 1 | get all symbols based on the environment context lineage to the root environment |
| GetEnumerator | 1 | get all symbols in current environment context |
| PushEnvironmentContext | 1 | add all of the data symbols from parent to join. |
| op_Concatenate | 1 | join two runtime environment, this function works for the function closure environment setup initialization. |
| GetAcceptorArguments | 1 | |
| Clear | 1 | |
| FindFunctionWithNamespaceRestrict | 2 | |
| Evaluate | 1 | |
| ToString | 1 | |
| Dispose | 1 |
03 Properties
| Name | Overloads | Summary |
|---|---|---|
| parent | 1 | 最顶层的closure环境的parent是空值来的 |
| stackFrame | 1 | The name of this current stack closure.(R function name, closure id, etc) |
| stackTrace | 1 | debug.getEnvironmentStack()) |
| funcSymbols | 1 | 导入的函数列表 |
| messages | 1 | 主要是存储警告消息 |
| globalEnvironment | 1 | the global environment |
| last | 1 | get value of the special last variable in R# Environment |
| debugger | 1 | the debugger context object for the current R# interpreter runtime |
| isGlobal | 1 | It is the top level global environment? |
| value | 1 | Get/set variable value |
| isLINQContext | 1 |
04 Fields
| Name | Overloads | Summary |
|---|---|---|
| global | 1 | In the constructor function of GlobalEnvironment, require attach itself to this parent field So this parent field should not be readonly |
05 Members
run environment initialize:
context constructor for parallel task
| Name | Type | Description |
|---|---|---|
parent | Environment | - |
stackName | String | - |
symbols | IEnumerable(Of Symbol) | - |
funcs | IEnumerable(Of Symbol) | - |
| Name | Type | Description |
|---|---|---|
isInherits | Environment | If is inherits mode, then all of the modification in sub-environment will affects the parent environment. Otherwise, the modification in sub-environment will do nothing to the parent environment. |
Create a new runtime environment context
| Name | Type | Description |
|---|---|---|
parent | Environment | - |
stackFrame | StackFrame | - |
isInherits | Boolean | If is inherits mode, then all of the modification in sub-environment will affects the parent environment. Otherwise, the modification in sub-environment will do nothing to the parent environment. |
get all variable symbol names(function symbol is not included)
String, Object)Try to get value of the specific symbol
| Name | Type | Description |
|---|---|---|
name | String | - |
this function returns nothing by default if the symbol is missing in the environment context
a shortcut wrapper function pointer for base.print()
Object, MSG_TYPES)add error/warning message
| Name | Type | Description |
|---|---|---|
message | Object | - |
level | MSG_TYPES | - |
add error/warning message
| Name | Type | Description |
|---|---|---|
msg | Message | - |
StackFrame)replace current stackframe information
this method used for the internal R# loop, example like for loop/apply loop, etc
| Name | Type | Description |
|---|---|---|
stackframe | StackFrame | - |
String, Boolean)这个函数查找失败的时候只会返回空值
| Name | Type | Description |
|---|---|---|
name | String | - |
inherits | Boolean | andalso look into the parent environment for the target symbol by name? |
String, Boolean)会首先在当前环境中的符号列表查找函数,如果不是函数则会在当前环境的函数列表中查找 如果当前环境中不存在,则会在父环境中查找符号
| Name | Type | Description |
|---|---|---|
name | String | - |
[inherits] | Boolean | - |
returns nothing if symbol not found
String, Boolean)just removes the symbol reference in the runtime environment
| Name | Type | Description |
|---|---|---|
name | String | target symbol name that will be removes from the current environment context. |
seekParent | Boolean | andalso removes the symbol with the same name in any parent environment context? (是否将任意环境路径中的目标符号引用进行删除?) |
String, Object, Boolean)do value assign
| Name | Type | Description |
|---|---|---|
name | String | - |
value | Object | - |
strict | Boolean | create a new symbol automatically if target symbol name is not exists in current environment context? otherwise this function will populate an error message if this parameter value is config as false by default. |
Variable declare, just add a new symbol in current environment context.
| Name | Type | Description |
|---|---|---|
name | String | - |
value | Object | - |
mode | Boolean | - |
overrides | TypeCodes | enable overrides the constant symbol which is in status of lock binding? |
返回错误消息或者对象值
Object)| Name | Type | Description |
|---|---|---|
type | TypeCodes | - |
value | Object | 应该是确保这个变量值是非空的 |
Boolean)get all function symbols based on the environment context lineage to the root environment
Boolean)get all symbols based on the environment context lineage to the root environment
not includes the function symbols
get all symbols in current environment context
add all of the data symbols from parent to join.
| Name | Type | Description |
|---|---|---|
join | Environment | - |
parent | Environment | - |
join two runtime environment, this function works for the function closure environment setup initialization.
this operator procedure calls may lock all of the parent environment context chain in parallel context
| Name | Type | Description |
|---|---|---|
closure | Environment | - |
parent | Environment | - |
最顶层的closure环境的parent是空值来的
The name of this current stack closure.(R function name, closure id, etc)
from current stack to top stack
导入的函数列表
主要是存储警告消息
A collection of the warning message
the global environment
get value of the special last variable in R# Environment
the debugger context object for the current R# interpreter runtime
这个属性对外暴露了调试器的核心对象, 使得宿主程序可以在不访问 Environment.debugger 这个 Friend 字段的情况之下, 就可以通过订阅 DebuggerContext.OnBreakpointHit 事件 并且调用 DebuggerContext.Resume() 函数的方式来驱动调试会话
It is the top level global environment?
(当前的环境是否为最顶层的全局环境?)
String)Get/set variable value
If the current stack does not contains the target variable, then the program will try to find the variable in his parent.
if variable in format like [var], then it means a global or parent environment variable
| Name | Type | Description |
|---|---|---|
name | String | - |
getter of this property is a wrapper of function Environment.FindSymbol(), and the setter of this property is a wrapper of visit data table Environment.symbols.
In the constructor function of GlobalEnvironment, require attach itself to this parent field So this parent field should not be readonly
String, String)String)IEnumerable(Of Expression))