Meta Commands
#16
A few foos too many in my examples...   LOL!  Once they start, and copy-paste hits, they never stop!

FUNCTION foo
IF junk < 10 THEN foo = foo OR 1
IF junk >9 AND foo < 100 then foo = foo OR 2
IF junk > 99 and foo < 1000 THEN foo = foo OR 4


Those two foos in red should've been junk instead, and junk, of course, would probably be best as SHARED junk, so you at least have a value with it to work with...  

What can I say?  It's after-midnight coding at its most honest!  Tongue

The point of the way old code worked, "foo = foo OR 1"  <-- here this was both references to the variable named foo, which held our return value.  After the fix, the one on the left was the variable; the one on the right became a recursive function call.

And that ended up breaking a lot of old code.  (Now folks will argue that it was "BADLY WRITTEN CODE", but that's debatable.  If it worked as the programmer intended, because that was an allowable syntax to the language, then how could it be badly written?  Only code that doesn't work, or that works but gives the wrong results, can be called badly written.)  Be what it may, it *used* to work, but after the "fix" to recursion, it didn't anymore.  

And we still have folks pop up on the forums or in the discord asking why their old stuff no longer works on newer versions of QB64 because of it.  But, at this point, what can one say except, "It is what it is."  Wink
Reply


Messages In This Thread
Meta Commands - by NasaCow - 11-16-2022, 03:41 AM
RE: Meta Commands - by mnrvovrfc - 11-16-2022, 04:49 AM
RE: Meta Commands - by NasaCow - 11-16-2022, 11:44 AM
RE: Meta Commands - by SMcNeill - 11-16-2022, 04:06 PM
RE: Meta Commands - by mnrvovrfc - 12-06-2022, 04:08 AM
RE: Meta Commands - by bplus - 11-16-2022, 05:13 AM
RE: Meta Commands - by NasaCow - 11-16-2022, 11:47 AM
RE: Meta Commands - by TerryRitchie - 11-16-2022, 04:28 PM
RE: Meta Commands - by SMcNeill - 11-16-2022, 04:48 PM
RE: Meta Commands - by TerryRitchie - 11-16-2022, 06:50 PM
RE: Meta Commands - by RhoSigma - 11-16-2022, 05:22 PM
RE: Meta Commands - by bplus - 11-16-2022, 05:33 PM
RE: Meta Commands - by mnrvovrfc - 11-16-2022, 06:36 PM
RE: Meta Commands - by SMcNeill - 12-06-2022, 05:26 AM
RE: Meta Commands - by mnrvovrfc - 12-06-2022, 06:07 AM
RE: Meta Commands - by SMcNeill - 12-06-2022, 07:12 AM



Users browsing this thread: 5 Guest(s)