With the change to the QString class, this optimization will not work, and is not necessary. The sub-string functions (LEFT$, MID$, and RIGHT$) will work like the other string functions and operators where they will return a temporary string. However, sub-string assignments will need to be handled differently. There will need to be specific new codes for handling sub-string assignments, to be named AssignLeft, AssignMid2, AssignMid3, and AssignRight.
Consider the following sub-string assign along with the old translation and the proposed new translation:
LEFT$(A$,5)=B$With the old translation, the sub-string reference would be on the stack (along with the value to assign) for the generic AssignSub$ to process. The new translation is simpler where the new AssignLeft code will expect a regular variable reference, the length argument of the LEFT$ function, and the value to assign. Internally all the sub-string assignment codes will use the QString::replace() function.
Old: A$<ref> 5 LEFT$(<ref> B$ AssignSub$
New: A$<ref> 5 B$ AssignLeft
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)