12-10-2023, 05:01 AM
(12-10-2023, 04:53 AM)a740g Wrote: This is a rather intriguing idea. Personally, I love the idea of having an easily accessible math expression evaluator built into the language. However, Val historically have never parsed expressions. Doing this now, would be a breaking change. Perhaps we can expand Val like n = Val("3 * 3", -1), where the second optional argument would tell Val to enable the parser. No promises. Just thinking out loud.
Personally, I think this would be a terrible idea. Basically, you'd be moving the math evaluator which we use for CONST and applying it to Val... and I can hear the complaints already!! "Why isn't this command implemented? Why can't I do VAL ("3 * INSTR(x$, "foo")")? Or VAL("(ASC("B")")? OR....
I predict nightmares for whoever is going to try to implement such.
Instead, we should consider having a Resources folder, include the math evaluator in it, and then folks can just:
Code: (Select All)
PRINT Math$("3 * 3")
'$INCLUDE:'./Resources/math_eval.bas'