Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
kymon
Novice


Joined: 29 Jan 2003
Posts: 40

PostPosted: 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 ;)
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
kymon
Novice


Joined: 29 Jan 2003
Posts: 40

PostPosted: 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)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net