HookType

enum HookType : Enum<AvailRuntime.HookType>

A HookType describes an abstract missing behavior in the virtual machine, where an actual hook will have to be constructed to hold an A_Function within each separate AvailRuntime.

Parameters

hookName

The name to attach to the A_Functions that are plugged into hooks of this type.

functionType

The signature of functions that may be plugged into hook of this type.

primitive

The Primitive around which to synthesize a default A_Function for hooks of this type. If this is null, a function that invokes P_EmergencyExit will be synthesized instead.

Entries

Link copied to clipboard
DEFAULT_STYLER("«default styler»", functionType( tuple( PhraseKind.PARSE_PHRASE.mostGeneralType), Types.TOP.o), P_DefaultStyler)

The HookType for a hook that holds the A_Function to invoke when a method or macro send is ready to be styled (a top-level statement was parsed unambiguously, and this phrase's children have had their chance to apply styling), but the most specific method/macro definition being invoked does not specify its own styler.

Link copied to clipboard
BASE_FRAME("«base frame»", functionType( tuple( mostGeneralFunctionType(), mostGeneralTupleType), Types.TOP.o), P_InvokeWithTuple)

The HookType for a hook that holds the A_Function to invoke at the outermost stack frame to run a fiber. This function is passed a function to execute and the arguments to supply to it. The result returned by the passed function is returned from this frame.

Link copied to clipboard
RAISE_JAVA_EXCEPTION_IN_AVAIL("«raise Java exception in Avail»", functionType( tuple( pojoTypeForClass(Throwable::class.java)), bottom), null)

The HookType for a hook that holds the A_Function to invoke when an exception is caught in a Pojo invocation of a Java method or CallbackSystem.Callback.

Link copied to clipboard
IMPLICIT_OBSERVE("«variable with a write reactor was written without write-tracing»", functionType( tuple( mostGeneralFunctionType(), mostGeneralTupleType), Types.TOP.o), null)

The HookType for a hook that holds the A_Function to invoke whenever an A_Variable with write reactors is written to when write tracing is not enabled.

Link copied to clipboard
INVALID_MESSAGE_SEND("«failed method lookup»", functionType( tuple( enumerationWith( set( AvailErrorCode.E_NO_METHOD, AvailErrorCode.E_NO_METHOD_DEFINITION, AvailErrorCode.E_AMBIGUOUS_METHOD_DEFINITION, AvailErrorCode.E_FORWARD_METHOD_DEFINITION, AvailErrorCode.E_ABSTRACT_METHOD_DEFINITION)), Types.METHOD.o, mostGeneralTupleType), bottom), null)

The HookType for a hook that holds the function to invoke whenever an A_Method send fails for a definitional reason.

Link copied to clipboard
RESULT_DISAGREED_WITH_EXPECTED_TYPE("«return result disagreed with expected type»", functionType( tuple( mostGeneralFunctionType(), topMeta(), variableTypeFor(Types.ANY.o)), bottom), null)

The HookType for a hook that holds the function to invoke whenever a returned value disagrees with the expected type.

Link copied to clipboard
READ_UNASSIGNED_VARIABLE("«cannot read unassigned variable»", functionType(emptyTuple, bottom), null)

The HookType for a hook that holds the function to invoke whenever an unassigned variable is read.

Link copied to clipboard
STRINGIFICATION("«stringification»", functionType(tuple(Types.ANY.o), stringType), P_ToString)

The HookType for a hook that holds the stringification function.

Properties

Link copied to clipboard
val defaultFunctionSupplier: OnceSupplier<A_Function>

A supplier of a default A_Function to use for this hook type.

Link copied to clipboard
val functionType: A_Type

The A_Function that hooks of this type use.

Link copied to clipboard
val hookName: A_String

The name to attach to functions plugged into this hook.

Link copied to clipboard
val name: String
Link copied to clipboard
val ordinal: Int