AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Recursive Expressions

 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
apocalypse~r



Joined: 21 Jun 2007
Posts: 41
Location: 43.074233,-72.424707

PostPosted: Fri Jul 04, 2008 7:41 am    Post subject: Recursive Expressions Reply with quote

when a variable is derefed as part of an expression, like this:
Code:
expression := "x"
x = 4
var := %expression%

it evaluates to 4, because that expression is basically the same as:
Code:
var := x

-but-
when an expression inside a variable is derefed as part of an expression (a recursive expression is called), like this:
Code:
x = 4
expression := "x * 3"
var := %expression%

which would logically be evaluated as:
Code:
var := x * 3

it causes an error, because ahk thinks that only a variable can be dynamically referenced. If the system is chanced so that when the := operator is found, the right side is then evaluated as a string (adding compatibility for expressions like:
Code:
var := "x * 3"
ans := %var%

while keeping support for dynamic variable references like:
Code:
fred := "bob"
ans := %fred%
ans := name%fred%.

)
_________________
problems := bugs + errors + glitches
(problems != 0) ? code := debug(code) : celebrate()
--
humor for: 1. Programmers 2. Everyone
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Oberon



Joined: 18 Feb 2008
Posts: 442

PostPosted: Fri Jul 04, 2008 9:05 am    Post subject: Reply with quote

It's already possible with lexicos' lowlevel hacks but I agree it would be useful as built-in feature.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group