Open myearwood1 opened 3 years ago
Hi Mike, That codepart wasn't modified that much, it's basically the original scctext from the holy MS gods. :) A lot of that stuff could get optimized, but 18 years ago, when we did that mods, this wasn't the prime topic. You're arguing about "Time consuming" & code? With todays processor speeds? In a routine which isn't used too much?
Basically that code deals with several different filestructures and resolves the problem of a limited Macrolength of 250 bytes. That's why it chops that fieldlist definition string into several parts by just cutting some 250 byte long strings and then adds those together in the resulting codeline for the CREA TABLE . They probably did this in 1995 because of not knowing future structure enhancements.... I don't know how you could avoid a & here. The only other way would be to really rewrite the whole part of storing and retrieving the Metadata structures, but then you wouldn't be backward compatible anymore. What if someone needs to get some 15 year old code back from the repository? That's why we haven't changed the general logic here to something more sophisticated.
That said, yes your loop optimization looks better and cleaner, thus just check it in!
wOOdy
Hi wOOdy. MS 'gods' didn't make that, but likely Fox gods. Even with the faster CPUs, I still encounter code that can be reduced from 15 minutes to mere seconds. I'll never opt for slower, especially once I get started. I'll check it in. Thanks for the kind words.
Hi Mike, just for arguing's sake :) The original author, Sherri Kennamer, was a MS employee in 1995, thus she was indeed a MS god, speaking FoxPro fluently :)
You could also get rid of that IF NOT EMPTY(cFieldList) condition, since you do a cFieldList ="" one line before :)
She was with Fox Software before, no? ;)
On Wed., Dec. 9, 2020, 3:44 a.m. Jürgen Wondzinski, < notifications@github.com> wrote:
Hi Mike, just for arguing's sake :) The original author, Sherri Kennamer, was a MS employee in 1995, thus she was indeed a MS god, speaking FoxPro fluently :)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/VFPX/AlternateSCCText/issues/2#issuecomment-741624976, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL36W2XK3YVQQJ3EV4KLMTST42HDANCNFSM4UIDLIWQ .
You're right. I did that to minimize further code changes. LOCAL i FOR i = 1 TO 6 STORE SUBSTR(m.cFieldList,250m.i-249,250) TO ('c'+TRANSFORM(m.i)) ENDFOR i IF NOT EMPTY(cFieldList) && will never happen, since VFP9 structures will not change anymore
In SccTextX there is a procedure CreateTable. It contains this bit of code:
I generally avoid &.
Seems to me there is no need to make the individual vars LOCAL. Let them be private and release them. If they are to be made local, since they are hardcoded in the create table line, they can be made LOCAL with 1 line before the loop. If they are to be made local in the loop, that too can be done without & like so: LOCAL ('c'+TRANSFORM(m.i)).
Cutting the cFieldList string down after each var is time consuming too.