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
JQuilici
Adept


Joined: 21 Sep 2005
Posts: 250
Location: Austin, TX

PostPosted: Fri Nov 09, 2007 7:34 pm   

[2.10] Creating variable NAMED '//module/name'
 
Summary

It is possible to create a variable with slashes in its name using #var //module/name value where 'module' is the name of a module that does not exist. The result is a setting in the root level with the name '//module/name'. This should not happen.

Procedure
  1. Open CMUD
  2. Dismiss the Sessions window by pressing ESC
  3. Type the following at the command line and hit Enter:
    Code:
    #var //foo/bar baz

  4. Open the Package Editor by pressing Ctrl-G. Verify that there is a variable in the root level of the untitled window with the name '//foo/bar' and the value 'baz'.



Notes
  • Oddly enough, the variable named '//foo/bar' CAN be accessed with @//foo/bar. However, if you ever actually create the module foo, you will no longer see it (since the actual foo module doesn't have a 'bar' variable in it). Also, '#unvar //foo/bar' will not delete the value.
  • A different, but related behavior can be seen with the following command:
    Code:
    #var //foo/bar/baz bag'

    When the Package Editor is opened, you will find that there is a variable in the 'bar' class in the untitled window, with the name 'baz' and the value 'bag' (also shown in the screenshot above). In this case, CMUD seems to throw away the name of the non-existent package (foo) and just create classes and subclasses. In other words, it behaves as if you had instead typed '#var /bar/baz bag'.

    I have not decided if this is right or not (since there is no good way to indicate that a #var command FAILED), but the behavior of the main procedure should at least match this. In other words, for consistency, '#var //foo/bar baz' OUGHT to result in a 'bar' variable at the root level of the untitled window.

    Another possible solution is to dynamically create the foo module in some default location (like classes and subclasses are dynamically created). Again, not sure if that would be right, and it could be fraught with peril. Please discuss.
_________________
Come visit Mozart Mud...and tell an imm that Aerith sent you!
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Nov 09, 2007 7:54 pm   
 
I would say for consistency creating a module in the package of the window is the way to go. The default option for a new module is Local, so I can't see a problem arising out of creating it on the fly the same way a class can be created.
_________________
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: Sat Nov 10, 2007 12:42 am   
 
Yep, I'll fix it to create the non-existent module. Added to bug list.
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