Bug? Wait For Complete

Star-Dust

Expert
Licensed User
An anomaly was reported to me today. A code that is marked error that is compiled and works

B4X:
Private Sub Main
  log(1)
  Wait For (Pausa) Complete   ' Don't write (Result a Boolean)
  log(2)
End Sub

Private Sub Pausa As ResumableSub
  Sleep(4000)
  ' don't write Return Boolean
End Sub

It works in B4A, B4J but it doesn't work in B4i.

I guess it's an anomaly, it shouldn't wait if the COMPLETE doesn't return anything. It should not compile if the ResumableSub does not return a value
 

Attachments

  • WaitForComplete.zip
    14 KB · Views: 71

LucaMs

Expert
Licensed User
Longtime User
Note that in b4a and b4j it would work even if Pause returned a value (I don't know in B4i because... you know).
 

Star-Dust

Expert
Licensed User
Note that in b4a and b4j it would work even if Pause returned a value (I don't know in B4i because... you know).
In b4i it only works if it is written correctly. If the return is missing or if the value after COMPLETE is missing it does not work
 

aeric

Expert
Licensed User
Longtime User
Is it because B4A and B4J compile to Java while B4i compiles to Objective-C code so they are different?
 

Star-Dust

Expert
Licensed User
Beyond the practical reason I suppose it is not the expected behavior otherwise it would behave the same on all platforms
 

LucaMs

Expert
Licensed User
Longtime User
Well, often I write something like:
B4X:
Wait For(Something) Complete(Unused As Boolean)
and, of course, I don't need that "Unused variable" (at least there).
Now I can simply write:
B4X:
Wait For(Something) Complete
to get what I need.

Are you sure that it does not work in B4i?
 

Star-Dust

Expert
Licensed User
I'm sure it doesn't work in b4i

In any case, regardless of how it works on B4i, I wanted an answer from Erel to understand if this is an expected behavior.

Since Erel has always suggested to insert a variable even without any significant value
 

LucaMs

Expert
Licensed User
Longtime User
I'm sure it doesn't work in b4i

In any case, regardless of how it works on B4i, I wanted an answer from Erel to understand if this is an expected behavior.

Since Erel has always suggested to insert a variable even without any significant value
Too bad we always have to wait for Erel.
Should there be more than one Erel or we should force him to work 7 days a week 😄
 

Star-Dust

Expert
Licensed User
Thanks Erel, it's not a big deal. It was just to confirm what I thought.
 
Top