Wish Indicator on the line where you call a Resumable Sub.

knutf

Member
Licensed User
Longtime User
I love resumable subs, but there are some pitfalls for the inexperienced rasumable sub user.

Let's say we have a Resumable sub:
Resumable Sub:
Sub doSomethingALotOfTimes As ResumableSub
    Log("Start doing something a lot of times")
    Dim a As Long
    For i  = 0 To 200000000
        Dim q As Double = Sqrt(i)
        If a = 0 Then
            Log(q)         
            a = 10000000
            Sleep(0)
        End If
        a = a - 1
    Next
    Log("Finished doing something a lot of times")
    Return Null
End Sub

The fact that it is a resumable sub make a big difference in the behavior of the calling routine. This code will not work as intended:
Calling routine:
Sub Button1_Click
    Log("Calls doSomethingALotOfTimes")
    doSomethingALotOfTimes
    Log("Do something when doSomethingALotOfTimes is finished")
End Sub

For a newbie as me it is not obvious that the code does not work as intended. I have to scratch my head a lot to understand why not.

The IDE shows a nice indicator next to the sub declaration. My wish is that the IDE shows an indicator next to the line where a resumable sub is called and a pop up text showing a hint for a newbie like me.

Something like this:

1598298395352.png
 
Top