#String surprise
3 messages in this thread
Tom, this turkey may surprise you:
1 X$="abcde"
2 MID$(X$,2)=X$
3 PRINT X$
(No, it WON'T change the program itself – it's harmless.)
For some reason, what DOES happen didn't surprise me – knew more about it a
year ago. Something like: RHS str vrbl refs yield just the descriptor (no copy)
until they're USED (as an OPERAND ) in the RHS(?). Whatever, if silicon virus
reduces your ROM2's to sand & you're back-to-BASIC dumpers, you now know how to
avoid the trashman!
obscurely yours, tim
*** There is a reply:
85677
Enter command, N for next
message or <ENTER> for menu:
Tim:
Well wallop muh wild wandering wumpuses! Just did it! Wondered if I'd
mis-typed.
Wondrous …
.^Dave^.
*** There is a reply:
85720
Enter command, N for next
message or <ENTER> for menu:n
Ain't nuthin', Dave: there's an OPEN statement that'll cause a coldstart! (
Not to worry – you won't do it by accident, & I'm not telling!)
Lemme explain the string thing a little, since it IS obscure:
It's a bug (of course). But unlikely you'll hit it innocently – you need a
MID$ on the LHS ("left-hand side"), and the SAME variable on the RHS, all by
itself (anything else on the RHS & it'll work: eg, '…=X$+""' works, as does
'…=MID$(X$,1)', etc.). So, not as bad as it looks.
There's a positive side, too: the WAY it fails implies that stmnts of the
FORM 'MID$(X1$,…)=X2$' don't create ANY string garbage; programs that spend
lots of time in BASIC's garbage collector can be sped up enormously by
rewriting stmnts IN that form (if possible).
Moral?: since Tandy won't fix their bugs, it's up to us to turn them into
FEATURES! Sigh,… (by the by, your outrageous alliterations always bring a
smile – thanks!) – tim
Enter command, N for next
message or <ENTER> for menu:n