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 

#DerefChar oddities

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
engunneer



Joined: 30 Aug 2005
Posts: 6551
Location: Pacific Northwest, US

PostPosted: Thu Sep 20, 2007 7:40 am    Post subject: #DerefChar oddities Reply with quote

http://www.autohotkey.com/forum/viewtopic.php?t=23387

1)
Help file wrote:

The following rarely used directives also exist; their usage is shown in these examples:
Code:

#DerefChar #  ; Change it from its normal default, which is %.



I get an error using the example of #
Quote:

---------------------------
testfile.ahk
---------------------------
Error at line 1.

Line Text: #derefchar #
Error: Parameter #1 invalid

The program will exit.
---------------------------
OK
---------------------------


also,
2)
Works:
Code:

#derefchar "
a1 = 7
bob = 1

result := test(a"bob")
msgbox "result"


test(var) {
return var + 1
}


Broken:
Code:

#derefchar '
a1 = 7
bob = 1

result := test(a'bob')
msgbox 'result'


test(var) {
return var + 1
}


Also,
3)
Code:

#derefchar ?
a1 = 7
bob = 1
Msgbox, ? a?bob?

should return 7, no? Returns a1. also returns a1:

Code:

#derefchar ?
a1 = 7
bob = 1
Msgbox, a?bob?

_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
God



Joined: 15 Jul 2007
Posts: 1151
Location: Enterprise, Alabama

PostPosted: Fri Sep 21, 2007 1:54 am    Post subject: Reply with quote

It may be the possibility that they are used in other functions there for Chris does not want them to be mistaken.
_________________
I'm back!
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6551
Location: Pacific Northwest, US

PostPosted: Fri Sep 21, 2007 5:07 am    Post subject: Reply with quote

' has no special meaning.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Nov 11, 2007 11:40 pm    Post subject: Reply with quote

Sorry for the late reply. I've fixed the problem with #DerefChar #. As for the single-quote character, it might be best to continue to forbid it in expressions in case it ever becomes an alternative way to quote strings (though this might not be until v2). Another reason is the rarity of using #DerefChar -- much less #DerefChar '. So it might be best to keep this restriction as a means of keeping scripts more compatible with future versions.

Perhaps #DerefChar and some of the others should be marked deprecated. Although these directives were part of the original 1.0 version, they've probably caused a lot more code maintenance problems than they're worth.

Thanks.
Back to top
View user's profile Send private message Send e-mail
engunneer



Joined: 30 Aug 2005
Posts: 6551
Location: Pacific Northwest, US

PostPosted: Sun Nov 11, 2007 11:44 pm    Post subject: Reply with quote

I think there are quite a few things that should be marked deprecated, with a link to a definition or deprecated page in the help file. Not alot of our users know the term, I expect.

I vote for all If statements that are not Expression Form to be deprecated., as well as EnvDiv, etc.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Nov 13, 2007 12:02 pm    Post subject: Reply with quote

I'm not sure that non-expression IF statements should be discouraged -- I suspect some people prefer them for simple operations (they also perform better). But I like your idea to relegate things like EnvDiv to another section because it should simplify the documentation. I'll try to do it the next time the docs are overhauled. Thanks
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports 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