AutoHotkey Community

It is currently May 27th, 2012, 12:50 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: AutoHotkey_L v1.1.00.01
PostPosted: July 17th, 2011, 1:16 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
1.1.00.01 (July 17)

Fixed: Modifier keys weren't auto-released when sending special chars. Image/Image
Fixed: Scancode/modifier-key mapping conflicts such as sc1xx vs ^sc0xx. Image
Fixed: $ and #UseHook had no effect if used only on the second or subsequent instance(s) of a hotkey. Image
Fixed: Potential crash when returning a value from a __Delete meta-function. Image
Fixed: "Uninitialized variable" warnings were triggered by the debugger. Image

Changed: base.Method() no longer triggers a default meta-function or a warning. Image
Changed: Gui +(Ex)Style no longer hides/shows the Gui. Image
Changed the debugger to report type="undefined" for uninitialized variables.

Added check to avoid incorrectly sending keystrokes for characters which actually require the "hankoku" key. Image
Added support for integers as class variable names. Image
Added "Static" keyword for declaring class variables. (See below)


Use of the var keyword in class definitions to declare static class variables should be avoided, as a future version (probably the next release) will repurpose it for declaring instance variables. There are some cases where behaviour won't be adversely affected; in other cases, scripts should be updated to use the static keyword.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2011, 1:25 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
Very nice! I look forward very much to instance variables.

It's also good to see that the hide/show quirk was fixed. Were the issues that Chris described in the source an artifact from older windows versions or did you discover a better way to avoid them?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2011, 7:30 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Thanks for the release :)

Lexikos wrote:
... a future version (probably the next release) will repurpose [the var keyword] for declaring instance variables.

Interesting - would there be any way to access this instance variable via a method defined in the class - other than accessing the class object by name? (see here)

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2011, 7:43 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I assume that the instance variable would be a simple key in the object that gets created by using the new operator, much like defining the variable in its constructor.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2011, 7:56 pm 
Offline

Joined: August 12th, 2008, 10:13 pm
Posts: 16
Thanks for this release! :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2011, 8:35 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
Awesome! Any chance the applicable changes are merged into ahk v2 alpha?

Lexikos wrote:
Use of the var keyword in class definitions to declare static class variables should be avoided, as a future version (probably the next release) will repurpose it for declaring instance variables. There are some cases where behaviour won't be adversely affected; in other cases, scripts should be updated to use the static keyword.


Hmm, along these lines, why don't you just take out "var" as a keyword completely, and use "local" for declaring instance variables along with what you're planning already with "static" as declaring class variables?

No need to add unnecessary keywords. KISS :)

_________________
Scripts - License


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2011, 10:57 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
I'm not sure if this was discussed before (I think I vaguely remember), but is var needed at all?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2011, 3:16 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
fragman wrote:
I assume that the instance variable would be a simple key in the object that gets created by using the new operator, much like defining the variable in its constructor.
Right. However, it will necessarily be separate from __New so that the initializers can be executed in order of base class -> derived class, and before __New is called.
infogulch wrote:
Any chance the applicable changes are merged into ahk v2 alpha?
It was a couple days ago, according to the list of changes in the v2 thread...
infogulch wrote:
Hmm, along these lines, why don't you just take out "var" as a keyword completely, and use "local" for declaring instance variables along with what you're planning already with "static" as declaring class variables?
Local variables are scoped to a function. Instance variables are not. A keyword like "set" or "init" might be more accurate (and less misleading), but not as nice. All instance and class "variables" still need to be qualified with the object (e.g. this.var), so differentiating them from local variables might be important.
fragman wrote:
... but is var needed at all?
In v1.1.00.01 it's the same as "static", but kept so that existing scripts don't need to be changed (yet). Instance variables (which aren't implemented yet) are needed in some cases, particularly those involving objects - e.g. static arr := [1,2,3] creates a shared object whereas var arr := [1,2,3] creates one for each instance of the class.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2011, 4:45 am 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
Lexikos wrote:
infogulch wrote:
Hmm, along these lines, why don't you just take out "var" as a keyword completely, and use "local" for declaring instance variables along with what you're planning already with "static" as declaring class variables?
Local variables are scoped to a function. Instance variables are not. A keyword like "set" or "init" might be more accurate (and less misleading), but not as nice. All instance and class "variables" still need to be qualified with the object (e.g. this.var), so differentiating them from local variables might be important.
Why use keyword at all? I can understand that static variables need to be distinguished from instance variables, so that should have a keyword. I don't however understand why this can't work.
Code:
class A
{
   InstanceVar := "Value" ; Can this mean anything other than the expected?
}

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2011, 5:11 am 
Symmetry/consistency.


Top
  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2011, 9:10 am 
Offline

Joined: March 10th, 2011, 7:17 pm
Posts: 374
Frankie wrote:
Why use keyword at all? I can understand that static variables need to be distinguished from instance variables, so that should have a keyword. I don't however understand why this can't work.
Code:
class A
{
   InstanceVar := "Value" ; Can this mean anything other than the expected?
}


i agree. this is all getting confusing for me, but i guess we'll see what the final thing looks like in the next release, and then maybe it'll make more sense


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2011, 9:27 am 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
Lexikos-nli wrote:
Symmetry/consistency.


Why not add public/private keywords then? Then you could get rid of the "var" keyword and still provide functionality with the keyword :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2011, 3:54 pm 
Offline

Joined: October 7th, 2006, 4:50 pm
Posts: 3157
Location: MN, USA
+1

Keywords are nice for readability, but "var" is one of the most common names for all generic variables and doesn't convey any special meaning. Keywords should be descriptive. On the other hand, memorizing keywords is another barrier to entry that makes it harder for new users to learn a language. Every keyword should produce a tangible benefit, i.e. provide some utility that cannot easily be gained in another way. On that note, I suggest an eventual page in the Help file dedicated to keywords (with a table similar to the one dedicated to escape characters).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 21st, 2011, 3:50 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
fragman wrote:
Why not add public/private keywords then?
Access modifiers are irrelevant. Anything with a reference to the class/object can access the "variable", and anything without a reference cannot. Access controls could not be implemented at load-time without typed variables, and could not be implemented at run-time without reducing performance (and providing very little benefit for that matter).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 27th, 2011, 9:17 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
I've decided to remove the "var" keyword entirely in the next release. Instance variables will be declared/initialized by simply writing Name := Expression in the class definition, outside any method definitions. However, note that Name is the only context in which you will be able to refer to an instance variable without specifying the object (like this.Name). Expression can refer to this, but any other variable reference will be global.

Thanks for the feedback.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group