IDuckTypeDecorator

Overview

If placed on a class and the DuckTypeAspectAttribute is located on this class, it will be called every time a user uses the duck<T>() expression.

Location

Required Methods


TryDuckType

Called by the compiler for each duck<> if none of the high priority duck typing aspects can deal with this.

 

method TryDuckType(aContext: IContext; aInput: Value; aInputType: IType; aTargetType: IType; aMode: DuckTypeAspectKind): Value

 

Value TryDuckType(IContext aContext, Value aInput, IType aInputType, IType aTargetType, DuckTypeAspectKind aMode)

 

func TryDuckType(_ aContext: IContext, _ aInput: Value, _ aInputType: IType, _ aTargetType: IType, _ aMode: DuckTypeAspectKind) -> Value

 

Value TryDuckType(IContext aContext, Value aInput, IType aInputType, IType aTargetType, DuckTypeAspectKind aMode)

 

Function TryDuckType(aContext As IContext, aInput As Value, aInputType As IType, aTargetType As IType, aMode As DuckTypeAspectKind) As Value

Parameters:

  • aContext: context for resolving types
  • aInput: Input value
  • aInputType: type of the input value
  • aTargetType: target type for the duck typing aspect
  • aMode: mode passed (static if none was applied)