Game: various *mites: Four Equals Ten


Author Message
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1182
Posted: 05:18pm 14 Jan 2023      

Some quick testing with different strings seems to indicate that the EVAL statement is well behaved with errors. The C stack doesn't change, even with "Syntax", "No closing bracket" and "Divide by zero" errors.

The following does not generate an error: (stuff after a close bracket is ignored - hmmm...)
Dim te$ = "1)+2"

c = 0
Do
 Inc c
 On error skip
 ans = Eval(te$)
 Print c, te$ " =" ans, MM.Info(stack), MM.ErrMsg$
 Pause 50
Loop


Feeding errors to EVAL is horrible? Perhaps, but for this game application, I'd pretty much have to perform all the functionality of EVAL just to determine if the string is syntactically correct. Sort of defeats the purpose. Fortunately you (Matherp) have done an awesome job coding EVAL into MMBasic and it works splendidly.

My bug chasing continues...