Search found 96 matches

by sirksel
Today, 12:34
Forum: AutoHotkey v2 Help
Topic: New object model diagram?
Replies: 0
Views: 12

New object model diagram?

I keep having issues visualizing the new prototype-based object model, especially how class, class.prototype, object, and object.prototytpe all relate. I know we have this explanation from the documentation: Each class object is based on whatever class it extends, or Object if not specified. The glo...
by sirksel
20 Nov 2020, 21:25
Forum: AutoHotkey v2 Help
Topic: how to reference class/subclass object inside instance method? Topic is solved
Replies: 10
Views: 441

Re: how to reference class/subclass object inside instance method? Topic is solved

swagfag this was very helpful. After reading your response, my more focused question then, is by creating a reference to the class of an instance (inside an instance method), does that prevent instances themselves from being destroyed? Based on your answer, I'm thinking the answer is no for two rea...
by sirksel
15 Nov 2020, 20:40
Forum: AutoHotkey v2 Help
Topic: how to reference class/subclass object inside instance method? Topic is solved
Replies: 10
Views: 441

Re: how to reference class/subclass object inside instance method? Topic is solved

swagfag and Helgef , quick follow-up question... I was reading another thread answer you wrote (related to GUIs) that reminded me how circular references can make objects indestructible without first manually removing the references. As it relates to the question in this thread, I've added a "class...
by sirksel
15 Nov 2020, 20:16
Forum: AutoHotkey v2 Help
Topic: Making a real Enumerator instance Topic is solved
Replies: 1
Views: 61

Making a real Enumerator instance Topic is solved

As I've been extending the array class (as well as map and other classes) with DefineProp/DefineMethod to contain certain utility properties/methods, I've written some that return enumerators. For example, I've done things like this in array: enmr ;reverse enumerator of (key,val) or (val) based on a...
by sirksel
30 Oct 2020, 01:34
Forum: AutoHotkey v2 Help
Topic: how to reference class/subclass object inside instance method? Topic is solved
Replies: 10
Views: 441

Re: how to reference class/subclass object inside instance method? Topic is solved

Great writeup, Helgef . Sorry I missed it before posting this thread. Quick question, extending your logic/examples, would it be bad form or bad performance hit to DefineProp to add a getter property to the Object prototype more generally that basically is just class => %this.__Class% ? Since we hav...
by sirksel
25 Oct 2020, 07:50
Forum: AutoHotkey v2 Help
Topic: how to reference class/subclass object inside instance method? Topic is solved
Replies: 10
Views: 441

how to reference class/subclass object inside instance method? Topic is solved

I'm writing a class that is intended to be subclassed. Inside that class, I'm writing an instance method. Inside this instance method, I need to refer to a static variable of the class (or more likely, subclass) from which the instance was derived. How do I reference the subclass generically? (Basic...
by sirksel
30 Sep 2020, 13:20
Forum: AutoHotkey v2 Help
Topic: super-global access from class static __new() Topic is solved
Replies: 4
Views: 291

Re: super-global access from class static __new() Topic is solved

Thanks for the quick answer. As usual, your answer worked like a charm! #1: Your example global na in the main body worked to allocate the super-global to be later set by the static __new of class script_init, but I'm confused... Does the global declaration in the main body actually execute before t...
by sirksel
30 Sep 2020, 12:53
Forum: AutoHotkey v2 Help
Topic: How to check if a variable is a string? Topic is solved
Replies: 3
Views: 289

Re: How to check if a variable is a string? Topic is solved

You could also extend the solution above directly to strings. I don't think it's much faster than the type() comparison example, but I do this in my own code because it seems cleaner: string := class.new() string.prototype := ''.base s:='1', n:=1 msgbox s is string ; 1/true msgbox n is string ; 0/fa...
by sirksel
30 Sep 2020, 12:33
Forum: AutoHotkey v2 Help
Topic: super-global access from class static __new() Topic is solved
Replies: 4
Views: 291

super-global access from class static __new() Topic is solved

A very large code base I maintain relies on certain "super-globals" that create "constants", on which nearly every function/method depends either directly or indirectly. For example: global na := '`vna' ;sentry for missing parameter Wherever na is used throughout thousands of functions/methods, none...
by sirksel
18 Sep 2020, 08:14
Forum: Bug Reports
Topic: [a122] wrong string property call when string is name of func
Replies: 1
Views: 404

[a122] wrong string property call when string is name of func

Am I missing something obvious here? Seems like all strings should work the same and call the property defined for String. When the string happens to be the name of the function, it calls the property defined for Func. Is there possibly a bug in the Func("Name") optimization code, or is this the exp...
by sirksel
05 Sep 2020, 08:15
Forum: AutoHotkey v2 Help
Topic: overriding inherited property with value Topic is solved
Replies: 2
Views: 319

overriding inherited property with value Topic is solved

I know one can override a calculated property in a subclass by simply redefining the calculated property. Is there any way to revert back from a calculated to non-calculated property (value property or member access or whatever the correct term is)? I've tried various ways, but I keep getting the "p...
by sirksel
23 Aug 2020, 20:36
Forum: AutoHotkey v2 Help
Topic: [a122] InputHook issues Topic is solved
Replies: 6
Views: 2028

Re: [a122] InputHook issues Topic is solved

Wow! Thanks for the explanation. I do get the point that Critical and InputHook don't seem to work well together for the reasons you outline. By the way, except for this issue with InputHook, I've never had another issue with timers/hotkeys/hotstrings in lots of other contexts in this script (which ...
by sirksel
22 Aug 2020, 10:20
Forum: AutoHotkey v2 Help
Topic: [a122] InputHook issues Topic is solved
Replies: 6
Views: 2028

Re: [a122] InputHook issues Topic is solved

Maybe not quite fixed. I have one more issue. When I put this code back into my main script, it still worked in an unexpected way. I traced it down to an interaction with Critical . Here's the code: ;critical 10 ;UNCOMMENT THIS LINE TO CAUSE EARLY TERMINATION inp(len:=-1, tmo:=2.0, tmi:=1.0) ;input ...
by sirksel
15 Aug 2020, 13:35
Forum: AutoHotkey v2 Help
Topic: [a122] InputHook issues Topic is solved
Replies: 6
Views: 2028

Re: [a122] InputHook issues Topic is solved

Thanks, Lexikos. One * did the trick! Everything works as expected. I pulled this from some older code I hadn't run in a while, and I didn't even think about the fact that surplus parameters are no longer allowed. Must have been pre-a103 that I last ran this. I think the * handling is much better (e...
by sirksel
15 Aug 2020, 04:13
Forum: AutoHotkey v2 Help
Topic: [a122] InputHook issues Topic is solved
Replies: 6
Views: 2028

[a122] InputHook issues Topic is solved

I'm not sure if this is a bug, or my lack of understanding of the docs. Probably the latter... The help file for InputHook.Timeout says that "The timeout period ordinarily starts when Start is called, but will restart if this property is assigned a value while Input is in progress." The following is...
by sirksel
14 Aug 2020, 15:14
Forum: Bug Reports
Topic: [a119] bug: truthy evaluation of byref empty string Topic is solved
Replies: 2
Views: 1562

Re: [a119] bug: truthy evaluation of byref empty string Topic is solved

As of a121, this is fixed! Thank you.
For some reason, I'm unable to mark this topic solved. The button is missing...
by sirksel
08 Aug 2020, 07:44
Forum: Bug Reports
Topic: [a119] bug: truthy evaluation of byref empty string Topic is solved
Replies: 2
Views: 1562

[a119] bug: truthy evaluation of byref empty string Topic is solved

Seems only to be a problem when passing byref:

Code: Select all

x := ''
msgbox (x == '') ':' (!x)   ; 1:1
f(x), g(x)

f(byref v) {
  msgbox (v == '') ':' (!v)  ; BUG: 1:0
}

g(v) {
  msgbox (v == '') ':' (!v)  ; 1:1
}
Possibly related to the closure issues posted in a previous thread, but possibly not.
by sirksel
24 Jun 2020, 04:19
Forum: Bug Reports
Topic: [a112] from [a109] conversion issue
Replies: 7
Views: 2136

Re: [a112] from [a109] conversion issue

lexikos and swagfag Sorry friends... I pulled my post down (since it was the last) to try to make it shorter , but I didn't realize you were answering at the same time. The original post is below. You are correct, lexikos. It was a test class. =============================== SOLVED. I wasn't trying...
by sirksel
22 Jun 2020, 14:49
Forum: Bug Reports
Topic: [a112] from [a109] conversion issue
Replies: 7
Views: 2136

Re: [a112] from [a109] conversion issue

Helgef I've figured out why, I think, the error exists. The function is also named xl() . If I change the variable name to any other super-global name, it works. I thought this always worked before because the function namespace was separate. I referred to xl to get to the super-global object refer...

Go to advanced search