wharts this for:

Module mTestContract
    Sub Test()
        
        Dim someVal As Val = New Val
        someVal = 40
        Dim ctrFn As New contractFn
        Dim TestContract As contract = New contract(someVal, ctrFn)
        ctrFn.Link(TestContract)
        TestContract.Eval(40)
        
        someVal.contracts.Add(TestContract)
    
        
    End Sub
    
    
End Module



Class contractMgr
    
    Private __dict__ As New Dictionary
    
    Function Add(contract As contract)
        __dict__.Add(contract.Name, contract)
    End Function
    
    
    
End Class


Class contract
    
    Private __val__      As Val
    Private __fn__       As IContractFn
    Private __res__      As contractFnRes
    
    Sub class_initialize()
        
    End Sub
    
    Sub New(ByRef parentVal As Val, ByRef contractFn As IContractFn)
        Populate(parentVal, contractFn)
    End Sub
    
    Sub Populate(ByRef parentVal As Val, contractFn As IContractFn)
        Set __val__ = parentVal
        Set __fn__ = contractFn
        Set __res__ = New contractFnRes
        
        
    End Sub
    
    
    Property Get val() As Variant
        Return __val__.val
    End Property
    
    
    Sub Eval(value As Variant)
        Set __res__ = New contractFnRes
        __fn__.Apply(value)
    End Sub
    
    Function Name(Optional nameStr) As String
        Static __name__ As String
        
        Dim msg As String = "the first time and only the first time this function is ran, it should include an argument for the name of the contract, which can be set only once. At all subsequent runs, this method is meant to retreive the name of the contract."
        
        If IsMissing(nameStr) And __name__ = "" Then
            Err.Raise(9999, "Contract.name", msg)
        ElseIf NotMissing(nameStr) And __name__ = "" Then
            __name__ = nameStr
        ElseIf NotMissing(nameStr) Not __name__ = "" Then
            Err.Raise(9999, "Contract.name", msg)
        Else
            Return __name__            
        End If

    End Function
    
    Public Property Get Result() As contractFnRes
        Return __res__
    End Property
    
    Public Property Set Result(result As contractFnRes)
        Set __res__ = result
    End Property
    
    
End Class

Class contractFnRes
    Private __contractWasBroken__ As Variant
    Private __valOut__            As Variant
    
    Private Function IsReady() As Boolean
        Dim notReady As Boolean
        Dim e        As Long = 9001
        Dim id       As String = "ContractFnResult.ContractWasBroken.get"
        Dim msg      As String = "both ContractWasBroken and ValOut need to be written before retreiving either"
        
        If IsEmpty(__contractWasBroken__) Or IsEmpty(__valOut__) Then notReady = True
        If Not VarType(__contractWasBroken__) = vbBoolean Then notReady = True
        
        If notReady Then Err.Raise(e, id, msg)
        
        Return True
    End Function
    
    Property Let ContractWasBroken(state As Boolean)
        Static wasWritten As Boolean = False
        
        Dim e   As Integer = 9002
        Dim id  As String = "ContractFnResult.ContractWasBroken.let"
        Dim msg As String = "state of " & id & " can only be written once."
        
        If wasWritten = False Then
            wasWritten = True
            __contractWasBroken__ = state
        ElseIf wasWritten = True Then
            Err.Raise(e, id, msg)
        End If
    
    End Property
    
    Property Let ValOut(value As Variant)
        Static wasWritten As Boolean = False
        
        Dim e   As Integer = 9003
        Dim id  As String = "ContractFnResult.ValOut.let"
        Dim msg As String = "state of " & id & " can only be written once."
        
        If wasWritten = False Then
            wasWritten = True
            __valOut__ = value
        ElseIf wasWritten = True Then
            Err.Raise(e, id, msg)
        End If
    
    End Property
    
    Property Get ContractWasBroken() As Boolean
        If IsReady Then Return __contractWasBroken__
    End Property
    
    Property Get valOut() As Boolean
        If IsReady Then Return __valOut__
    End Property
    
End Class

Interface IContractFn
        
    ' Function Implementation(value As Variant)
    Function Apply(value As Variant) As contractFnRes
    
    Function Link(ByRef parentContract As contract)
    
    
End Interface



Class contractFn
    Implements IContractFn, contract Via __pContract__
    
    Function Link(ByRef parentContract As contract) Implements IContractFn.Link
        Set __pContract__ = parentContract
    End Function
        
    Function Apply(value As Variant) As contractFnRes Implements IContractFn.Apply
        
        Result.ContractWasBroken = True
        Result.ValOut = 999999
        
        Return Result
        
    End Function
    
End Class



Module cool:Sub testCool():Test:End Sub:End Module


' [COMCreatable(False)]
' Class ContractBase
'     Private __parent__ As Val
'     Private __mgr__    As contractMgr
    
    
'     Sub new(contract As contract)
        
'     End Sub
    
' End Class

' Interface IContract Extends ContractBase

    
    
    
    
' End Interface