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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Sat Aug 02, 2008 4:35 pm   

[2.35] Parsing error with @{${local}/xyz}
 
The following works:
Code:
$local = "b"
bxyz = "foo"
#SH {${local}xyz = @{${local}xyz}}
#IF (@{${local}xyz} = "foo") {#sh true} {#sh false}

But change the variable reference to include a class, and this gets a parsing error, but only in the #IF:
Code:
$local = "b"
b/xyz = "foo"
#SH {${local}/xyz = @{${local}/xyz}}
#IF (@{${local}/xyz} = "foo") {#sh true} {#sh false}

If you comment out the #IF (or remove it), it compiles, and #SHOWs the variable correctly.

A workaround seems to be:
Code:
$local = "b"
b/xyz = "foo"
#SH {${local}/xyz = @{${local}/xyz}}
$var = "/xyz"
#SH {${local}${var} = @{${local}${var}}}
#IF (@{${local}${var}} = "foo") {#sh true} {#sh false}
Reply with quote
Zugg
MASTER


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

PostPosted: Sat Aug 02, 2008 5:00 pm   
 
Sorry, but the syntax ${local} is not supported. You need to use something like:

@{%concat($local,$var)}
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Sat Aug 02, 2008 5:06 pm   
 
Too bad, because ${local} is consistent with the @{var} notation. And it does work in places (see the examples), just not in an #IF.
Reply with quote
Zugg
MASTER


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

PostPosted: Sat Aug 02, 2008 5:09 pm   
 
If it works sometimes then it's just a coincidence and side-effect of the parser...it was never intended to work that way and could easily stop working in a future version.
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Sat Aug 02, 2008 7:55 pm   
 
I accept that it isn't currently a supported feature, but I'd advocate that it should be. For one, it's consistent with @{var} and the same reasons to allow that syntax apply. It's convenient in situations where you want to substitute the variable with no punctuation between it and the next. "${local}abc" is nice and concise over "%concat($local, "abc")".
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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