[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New control structure "Do Next..."
[Thread Prev] | [Thread Next]
- Subject: New control structure "Do Next..."
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Sat, 17 May 2025 01:32:54 +0200
- To: Gambas Mailing List <user@xxxxxxxxxxxxxxxxxxxxxx>
Hi,
I have just added a new control structure to the Gambas language:
Do Next <statement>
It executes the statement "later", i.e. at the next run of the event loop.
To do the same thing, you had to use a Timer before. Something like that:
hTimer = New Timer As "RunLater"
hTimer.Trigger
...
Public Sub RunLater_Timer()
<statement>
End
I'm not yet fully satisfied with that syntax, even if it does not
introduce new keywords, which is always a positive thing.
But I may do something else:
Do <statement> Next
Do <statement> Later
Or more powerful:
Do
<statement 1>
<statement 2>
...
Next
Internally, the <statement> is directly compiled inside the function,
and is run in a special context where there is no local variable.
You can't use the local variables of the function inside <statement> at the moment.
This is not a lambda expression, for those who know what it is.And I think you can still do something like 'Do Next Goto ...' which must be forbidden too. So a work in progress...
Do not hesitate to tell what you think and give ideas. Regards, -- Benoît Minisini.
| Re: New control structure "Do Next..." | Jorge Carrión <shordi@xxxxxxxxx> |
| Re: New control structure "Do Next..." | Bruce Steers <bsteers4@xxxxxxxxx> |