| View previous topic :: View next topic |
| Author |
Message |
engunneer
Joined: 30 Aug 2005 Posts: 6551 Location: Pacific Northwest, US
|
Posted: Thu Sep 20, 2007 7:40 am Post subject: #DerefChar oddities |
|
|
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 |
|
 |
God
Joined: 15 Jul 2007 Posts: 1151 Location: Enterprise, Alabama
|
Posted: Fri Sep 21, 2007 1:54 am Post subject: |
|
|
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 |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6551 Location: Pacific Northwest, US
|
Posted: Fri Sep 21, 2007 5:07 am Post subject: |
|
|
' has no special meaning. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sun Nov 11, 2007 11:40 pm Post subject: |
|
|
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 |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6551 Location: Pacific Northwest, US
|
Posted: Sun Nov 11, 2007 11:44 pm Post subject: |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Nov 13, 2007 12:02 pm Post subject: |
|
|
| 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 |
|
 |
|