Search found 43 matches

by sirksel
20 May 2019, 17:02
Forum: AutoHotkey v2 Development
Topic: Changes to %fn%(), fn.call() or func('fn') syntax?
Replies: 1
Views: 241

Changes to %fn%(), fn.call() or func('fn') syntax?

Many thanks to lexikos for all the work he has done to enable fat arrow notation (e.g., fn(x,y) => x*y and x => x*2 ) and method/property shorthand (e.g., property[] => expr() ). It takes Func.Bind() to a whole new level, and really enables much more efficient functional programming (e.g., map, filt...
by sirksel
16 Nov 2018, 06:39
Forum: AutoHotkey v2 Development
Topic: [a100] fat arrow modifying dynamic var in outer scope Topic is solved
Replies: 3
Views: 638

Re: [a100] fat arrow modifying dynamic var in outer scope Topic is solved

That answers it perfectly, Helgef. I modified my thread title from "byref var" to "dynamic var" to make it more on-point with the real issue (dynamic, not byref) -- as you've helped me understand. Thanks.
by sirksel
15 Nov 2018, 21:20
Forum: AutoHotkey v2 Development
Topic: [a100] fat arrow modifying dynamic var in outer scope Topic is solved
Replies: 3
Views: 638

[a100] fat arrow modifying dynamic var in outer scope Topic is solved

Is there a limitation on fat arrow, which would not allow a function like (val, cnt) => var%cnt% := val to modify var1 ... var9 , which are byref variables in the enclosing scope? I've been trying to debug code, and have had success assigning to an outer scope array with identical code, so I'm guess...
by sirksel
26 Oct 2018, 16:55
Forum: AutoHotkey v2 Development
Topic: [a100] Parentheses no longer allowed for property calls? Topic is solved
Replies: 3
Views: 684

Re: [a100] Parentheses no longer allowed for property calls? Topic is solved

Thanks Helgef. I'm sure you all get this a lot, and I know you can change alpha features at any time. Was it causing problems for some new functionality? I had previously thought Lexikos was OK continuing to allow the parens calls... It's allowed for symmetry with x.y(z) := v, which is supported to ...
by sirksel
26 Oct 2018, 12:31
Forum: AutoHotkey v2 Development
Topic: [a100] Parentheses no longer allowed for property calls? Topic is solved
Replies: 3
Views: 684

[a100] Parentheses no longer allowed for property calls? Topic is solved

I've just updated to a100 from a095, and as is to be expected, a number of things broke in my scripts. Replacing <> with != was easy enough, but there is one thing that's been puzzling me. It used to be that properties could be called as either: obj.property[p1, p2] -OR- obj.property(p1, p2) (using ...
by sirksel
30 Apr 2018, 09:15
Forum: AutoHotkey v2 Development
Topic: IsFunc()-like test: IsCallable()? Topic is solved
Replies: 6
Views: 901

Re: IsFunc()-like test: IsCallable()? Topic is solved

Great point, nnnik! No sooner did I edit/repost my code than I discovered that simply adding or t=='BoundFunc' invalidates the truthiness/minparams branch of the return, since BoundFunc doesn't support any methods other than .Call. (I think that's why I initially excluded it, now that I think about ...
by sirksel
30 Apr 2018, 07:52
Forum: AutoHotkey v2 Development
Topic: IsFunc()-like test: IsCallable()? Topic is solved
Replies: 6
Views: 901

IsFunc()-like test: IsCallable()? Topic is solved

Now that we have closures/lambdas (thanks again, Lexikos!), I find myself using type(obj)=='Func' or type(obj)=='Closure' a lot to test whether or not a parameter is callable with .Call() . I use this primarily when a function can take a parameter that can be either a value or a function/lambda retu...
by sirksel
15 Apr 2018, 14:08
Forum: AutoHotkey v2 Development
Topic: scrap commands?
Replies: 48
Views: 6276

Re: scrap commands?

I know I'm in the minority, but I VOTE FOR KEEPING [/u] the parens-optional syntax. As others have pointed out, msgbox x , or in my case, my slightly customized version mbx x is really nice and quick for debugging. Small point, I know. For quick scripts with a lot of parameter-less calls, the () doe...
by sirksel
01 Apr 2018, 05:40
Forum: AutoHotkey v2 Development
Topic: inline lambda issue Topic is solved
Replies: 2
Views: 558

Re: inline lambda issue Topic is solved

Apologies for the duplicate. I've tested and can confirm this and similar behavior fixed in v2.0-a092. You're sure quick with the updates. Many thanks.
by sirksel
31 Mar 2018, 22:24
Forum: AutoHotkey v2 Development
Topic: inline lambda issue Topic is solved
Replies: 2
Views: 558

inline lambda issue Topic is solved

@Lexikos, I LOVE the high-order functions / lambda support you've added. I know some say scope creep... I say pure genius! Love it. I'm having a little trouble with the following. I've implemented a functional fold method in my custom list class that overrides Array() and [] . I won't post that code...
by sirksel
15 Jun 2017, 12:09
Forum: AutoHotkey v2 Development
Topic: a080: same-line if parsing error
Replies: 4
Views: 960

Re: a080: same-line if parsing error

Thanks for the clarification -- that helps a lot. One quick follow-up point... Of the examples at the end of your response, the last three have the desired effect, but the first one has a different effect, correct? Maybe that's what you meant by "the final condition is 'qty++'". In other words, the ...
by sirksel
14 Jun 2017, 07:56
Forum: AutoHotkey v2 Development
Topic: a080: same-line if parsing error
Replies: 4
Views: 960

a080: same-line if parsing error

Lexikos, did you change the way same-line if works in a080? For example: if t[idx]==na, (t[idx]:=dft, qty++) used to work fine, and it seems like it still follows the syntax rules I read. I was under the impression that multi-expression, especially when in parens, could be used anywhere a normal exp...
by sirksel
28 Oct 2016, 17:16
Forum: Ask For Help
Topic: Object.Delete(Key) Slower on Left than Right?
Replies: 6
Views: 716

Re: Object.Delete(Key) Slower on Left than Right?

Lexikos, do you think the code in the OP should generate a significant difference, whether deleting from the left or the right? For me the performance difference is like 10x whether I try to .Delete() all the items from the left vs. the right. It seemed like that was too great unless something was b...
by sirksel
28 Oct 2016, 11:17
Forum: Ask For Help
Topic: Object.Delete(Key) Slower on Left than Right?
Replies: 6
Views: 716

Re: Object.Delete(Key) Slower on Left than Right?

Thanks for your note back. I was under the impression that that was the difference between RemoveAt() and Delete(). RemoveAt() shuffled things down, but Delete() didn't. Am I not understanding that part right? Maybe I'm not understanding what the documentation is trying to say, but here's the passag...
by sirksel
28 Oct 2016, 06:13
Forum: Ask For Help
Topic: Object.Delete(Key) Slower on Left than Right?
Replies: 6
Views: 716

Object.Delete(Key) Slower on Left than Right?

Because Object.Delete(Key) doesn't slide left, even if deleting an integer key from the left, I was under the impression that the performance of deleting keys from the right or left should be more or less the same in terms of performance. When I was building a custom linked-list object, my left dele...
by sirksel
14 Oct 2016, 21:20
Forum: Ask For Help
Topic: Getting to first/next key in custom enum/next() Topic is solved
Replies: 8
Views: 1210

Re: Getting to first/next key in custom enum/next() Topic is solved

Thanks so much. I think I get it, at least to this point: ...making the call y[z](this, v) ; that is, (this.std)["Next"](this, var1) . But, I guess that's where I start to lose the logic. So when I call an object's Next directly, like thisenum.Next(key, val) , isn't the this implicitly the first par...
by sirksel
14 Oct 2016, 05:40
Forum: Ask For Help
Topic: Getting to first/next key in custom enum/next() Topic is solved
Replies: 8
Views: 1210

Re: Getting to first/next key in custom enum/next() Topic is solved

Thanks, Lexikos... many good ideas come from your "experiments"... The only part I don't understand is why this works: ;this.Next(var1) -> this.std.Next(this, var1) this.Next := ObjBindMethod(this.std, "Next") return this.Next(var1) I think that subsequent calls to enm2.Next are actually calling the...
by sirksel
13 Oct 2016, 04:46
Forum: Ask For Help
Topic: Getting to first/next key in custom enum/next() Topic is solved
Replies: 8
Views: 1210

Re: Getting to first/next key in custom enum/next() Topic is solved

Lexikos, as always, thanks so much! After your fixes, it works like a charm. An answer of yours is as good as gold, and always gives me a little more to think about each time. And, not surprisingly, it also usually involves you quoting some section of the documentation that I didn't properly read/di...
by sirksel
13 Oct 2016, 00:45
Forum: Ask For Help
Topic: Getting to first/next key in custom enum/next() Topic is solved
Replies: 8
Views: 1210

Re: Getting to first/next key in custom enum/next() Topic is solved

UPDATE: Here was my quick-and-dirty attempt that I referenced to call the standard enum before I overrode it. This code fails because base._newenum() returns an empty string. I'm definitely misunderstanding things, but I'd appreciate any pointers you all could give me. ; NOTE: code below is AHK v2 c...
by sirksel
12 Oct 2016, 19:26
Forum: Ask For Help
Topic: Getting to first/next key in custom enum/next() Topic is solved
Replies: 8
Views: 1210

Getting to first/next key in custom enum/next() Topic is solved

After re-reading a very helpful post from Lexikos on custom collection objects, I'm trying to change around some of my objects to support custom enumerators. However... I'm having trouble figuring out how to get at the first/next non-numerical key when you're overriding the _newenum() and next(). I'...

Go to advanced search