[Gambas-bugtracker] Bug #2483: Allow On Gosub and On Goto to use pointer/function array as target

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Thu Mar 3 21:19:45 CET 2022


http://gambaswiki.org/bugtracker/edit?object=BUG.2483&from=L21haW4-

Comment #5 by Brian G:

For state machine type implementations where the current state may accept a specific 
number of inputs, and there is a need for fast processing

So now I would write

on goto state1,state2,state3 ....

state1 on MyMessageType goto state11, state12, state13 ....

With a large number of inputs the on goto can/does become unmanageable!

but if one could do

states as variant = [state1, state2, state3]
state1 as (as what ever type this is) = [state11, state12, state13]
current_state as (what ever this is called)[] = states[1]

then one just writes

on MsgInputType goto current_state

of course have gosub support the same would be amazing.


So state table can be more easily managed for large projects
and simplify the implementation of a very fast process interface.

As an aside, why when I try this:
  print mylabel
does it always return 1 and typeof(mylabel) is always 4?
Also I can do this

  mylabel = 23
  print mylabel

It still prints 1




More information about the Bugtracker mailing list