|
kymon Novice
Joined: 29 Jan 2003 Posts: 40
|
Posted: Fri Dec 08, 2006 3:06 pm
[1.21] renaming variables |
renaming variables seems to leave traces of the old names in the view of the compile code. looks like this:
0036 VARREF @Directions <tracklist> (class mud)
"tracklist" was the old name of the var, "Directions" the new name. maybe this is the way it should be (renaming doesn't really rename, just create a reference?) (the old name gets kept for undoing purposes?). if not, this is a bug report ;) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Dec 08, 2006 3:44 pm |
This might be something to do with the way the compiler works - I remember Zugg saying that it won't be recompiled until it next runs, or something like that. Is that right?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Dec 08, 2006 10:33 pm |
Actually, as far as I can tell, during compilation a reference to the specific database record is determined. Renaming the variable does not actually affect its position in the database, leaving that reference value intact and valid. The event that ruins that reference is deletion of the variable through #UNVAR, which I bug reported a few versions ago.
All that said, I am pretty certain that the display data for the compiled code wasn't updated. The variable reference that will occur is still accurate. In some future version we should worry about things that come down to this sceondary visual level. Right now though I think there are more important things to be concerned about. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Dec 08, 2006 10:36 pm |
Fang is correct...it only recompiles settings as needed, so until you actually use the alias/trigger/whatever, then it might still have the old value in it. But post the exact steps that you are taking to rename the variable, along with the code for the alias or whatever you are looking at the compiled code for and I'll take a look at it. But my guess is that it's working fine.
Keep in mind that the Compiled Code tab is a look behind the scenes but it more for my own debugging purposed and not really meant to be understood by normal CMUD users. |
|
|
|
kymon Novice
Joined: 29 Jan 2003 Posts: 40
|
Posted: Sat Dec 09, 2006 4:02 am |
i tried to make a minimal example on [1.22]:
- create new alias "ctest" for "var1 = %1; say @var1"
- use alias: "ctest ok"
- variable "var1" gets created by cmud
- rename "var1" to "var2"
- modify alias "ctest" to "var2 = %1; say @var2"
- use alias "ctest ok"
- look at the compiled code of the alias ctest:
0000 LINE 1 ; var2 = %1
0012 PARAMREF 1
0020 VARASSIGN var2 60 43
0040 LINE 0 ; var2 = %1
0052 VARREF @var2 <var1> (class mud)
0076 ALIAS say (1) <?> (class mud) |
|
|
|
|
|