Table of Contents

Class CallableBindingHandle

Namespace
RDCore.SDK.Model.Values.Bindings
Assembly
RDCore.SDK.dll

A handle to a binding to a procedure declared in the workspace - a Sub, a Function or a property accessor - whose source code runs when the binding is invoked.

public record CallableBindingHandle : ICallableBinding, IBindingHandle, IEquatable<CallableBindingHandle>
Inheritance
CallableBindingHandle
Implements
Inherited Members

Remarks

Every callable binding, whatever Procedure is - a Sub, a Function, or a Property Get/Let/Set of any arity - only ever supports Invoke. GetValue(ISymbolResolver) and SetValue(ISymbolResolver, IRuntimeValue) are never supported: a property accessor is a procedure, its source code can validate, have side effects, or raise errors, and none of that is something a value-slot shortcut may bypass. A reference to a parameterless Function that evaluates to its result, or a read/write of a property that takes no index, is still an ordinary invocation - made with no arguments, but an invocation all the same.

A property accessor is the binding a read or a write of a property goes through, one handle per accessor. Whether a write goes to the Let or to the Set accessor is not something the handle can tell from the value written: it is the accessor the handle was made for. An indexed property is read and written by invoking its accessor with the index arguments.

Value is never supported: it reads without a resolver, and an invocation needs one.

The handle identifies the procedure and, for a member of a class, the object it is bound to; the IProcedureInvoker runs it.

Constructors

CallableBindingHandle(VBTypeMemberSymbol, IProcedureInvoker, IRuntimeValue?)

A handle to a binding to a procedure declared in the workspace - a Sub, a Function or a property accessor - whose source code runs when the binding is invoked.

public CallableBindingHandle(VBTypeMemberSymbol Procedure, IProcedureInvoker Invoker, IRuntimeValue? Receiver = null)

Parameters

Procedure VBTypeMemberSymbol

The Sub, Function or property accessor this handle invokes.

Invoker IProcedureInvoker

The execution engine that runs the source code of Procedure.

Receiver IRuntimeValue

The object a member of a class is bound to, null for a procedure of a standard module. It is the Me of the call: passed as the first argument (RD-VBAL: Me is the implicit parameter at index 0 of every member).

Remarks

Every callable binding, whatever Procedure is - a Sub, a Function, or a Property Get/Let/Set of any arity - only ever supports Invoke. GetValue(ISymbolResolver) and SetValue(ISymbolResolver, IRuntimeValue) are never supported: a property accessor is a procedure, its source code can validate, have side effects, or raise errors, and none of that is something a value-slot shortcut may bypass. A reference to a parameterless Function that evaluates to its result, or a read/write of a property that takes no index, is still an ordinary invocation - made with no arguments, but an invocation all the same.

A property accessor is the binding a read or a write of a property goes through, one handle per accessor. Whether a write goes to the Let or to the Set accessor is not something the handle can tell from the value written: it is the accessor the handle was made for. An indexed property is read and written by invoking its accessor with the index arguments.

Value is never supported: it reads without a resolver, and an invocation needs one.

The handle identifies the procedure and, for a member of a class, the object it is bound to; the IProcedureInvoker runs it.

Properties

BindingCapabilities

Indicates the valid members of this binding.

public BindingCapabilities BindingCapabilities { get; }

Property Value

BindingCapabilities

Invoker

The execution engine that runs the source code of Procedure.

public IProcedureInvoker Invoker { get; init; }

Property Value

IProcedureInvoker

Procedure

The Sub, Function or property accessor this handle invokes.

public VBTypeMemberSymbol Procedure { get; init; }

Property Value

VBTypeMemberSymbol

Receiver

The object a member of a class is bound to, null for a procedure of a standard module. It is the Me of the call: passed as the first argument (RD-VBAL: Me is the implicit parameter at index 0 of every member).

public IRuntimeValue? Receiver { get; init; }

Property Value

IRuntimeValue

Value

Not supported: reading a binding without a resolver cannot run source code.

public IRuntimeValue Value { get; }

Property Value

IRuntimeValue

Exceptions

NotSupportedException

Always.

Methods

Call(ISymbolResolver, IRuntimeValue[])

Invokes the procedure and returns the outcome of the call as a result, the way the semantics of the language do: an error raised in the procedure, that nothing handled, is in the result rather than thrown.

public RuntimeSemanticsEvaluationResult Call(ISymbolResolver resolver, IRuntimeValue[] args)

Parameters

resolver ISymbolResolver

A read-only interface over the current execution context.

args IRuntimeValue[]

The arguments of the call, without the Me of a member of a class, which the handle passes itself.

Returns

RuntimeSemanticsEvaluationResult

The result of the call: the value the procedure returns (the Void value for a Sub), or the run-time error it raised.

GetValue(ISymbolResolver)

Not supported: a procedure, including a property accessor, is never read as a value - see Invoke(ISymbolResolver, IRuntimeValue[]).

public IRuntimeValue GetValue(ISymbolResolver resolver)

Parameters

resolver ISymbolResolver

Returns

IRuntimeValue

Exceptions

NotSupportedException

Always.

Invoke(ISymbolResolver, IRuntimeValue[])

Invokes the procedure and returns the runtime value it returns - the HRESULT S_OK, for a Sub.

public IRuntimeValue Invoke(ISymbolResolver resolver, IRuntimeValue[] args)

Parameters

resolver ISymbolResolver

A read-only interface over the current execution context.

args IRuntimeValue[]

The arguments of the call, without the Me of a member of a class, which the handle passes itself.

Returns

IRuntimeValue

Remarks

👉 A caller that handles the errors of the program, or needs the typed value of the call, uses Call(ISymbolResolver, IRuntimeValue[]), which returns them instead of throwing.

Exceptions

VBRuntimeErrorException

A run-time error was raised in the procedure and nothing handled it.

InvalidOperationException

The invoker could not run the procedure, and has no error to say why.

SetValue(ISymbolResolver, IRuntimeValue)

Not supported: a procedure, including a property accessor, is never assigned as a value - see Invoke(ISymbolResolver, IRuntimeValue[]).

public void SetValue(ISymbolResolver resolver, IRuntimeValue value)

Parameters

resolver ISymbolResolver
value IRuntimeValue

Exceptions

NotSupportedException

Always.