Search found 299 matches

by vvhitevvizard
11 Dec 2018, 15:14
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

Seems to run fine for me... you sure you didn't use [] instead of () by accident? was my mistake - I re-set a1 accidentally. well, back to results: 1375|1343|1891 : new . set/get variant seems to be 39% as slow in my case. class a1{ class test { static key3:=0 } } class obj{ str[_s]{ get { return(%...
by vvhitevvizard
11 Dec 2018, 14:25
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

Hey, I think you forgot to call the functions there Oh indeed! my bad :D It should be: t:=A_TickCount ostr3(p*) => p.length() > 1 ? obj.str[p[1]] := p[2] : obj.str[p[1]] loop(n) ostr3("a1.test.key3", "new") a3:=A_TickCount-t but 2 previous ostr1 and ostr2 give me an error. (ahk v2, last alpha build...
by vvhitevvizard
11 Dec 2018, 14:19
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

But then wouldn't your second example (even if it worked) be equivalent to normal get{....}, set{....}? don't know about run-time speed improvements, but we obviously get 1 line instead of 6 repetitive ones. Even more, with fat arrows we get a portable code snippet (just an expression) and can incl...
by vvhitevvizard
11 Dec 2018, 13:48
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

oif2003 wrote:
11 Dec 2018, 12:32
The first two are about the same in speed while the last one is about 30% slower. Set/Get is still faster.
U mean the last one is 30% as fast? :D Good to know! :thumbup:

edited: code removed - see next page for the correct one
by vvhitevvizard
11 Dec 2018, 12:52
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

Do you mean something like this? Not for this use case, :D I meant fat arrows used for property's half-methods declarations. the following code is not working ( "Unknown property" error), just to give u an idea. class a1{ static key1:="string1" } deref["aa.key1"]:="new" class deref{ static set:=(_s...
by vvhitevvizard
11 Dec 2018, 12:03
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

Maybe we can shorten it a little? I optimized it a bit. Removed intermediate var o and made the whole calculation as a single operation: class obj{ str[_s]{ ;deref string get{ ;v:=["obj1.objN.key"] return(%(m:=StrSplit(_s,".")).RemoveAt(1)%[m*]) ;[m*] =variadic multi-dimentional } set{ ;["obj1.objN...
by vvhitevvizard
10 Dec 2018, 19:03
Forum: Ask For Help
Topic: AHK v2: question about enumerating
Replies: 4
Views: 479

Re: AHK v2: question about enumerating

well, as for now I ended up with the following: try a:=o.__Arr ;trying to get a unique key catch{ ;"Unknown property" exception means its a built-in inenumerable object t:=Type(o) t = Object type instead of object content to pretty-print my instanced classes and other global vars like this: https://...
by vvhitevvizard
10 Dec 2018, 13:59
Forum: Ask For Help
Topic: AHK v2: question about enumerating
Replies: 4
Views: 479

Re: AHK v2: question about enumerating

Because there is curretnly no difference. thank u for the quick reply! yeah, I've seen it in the documentation. I, for one, hate ambiguity in programming languages and can't wait for the moment Lexicos decides these two array types become different. He already removed <> operator (as duplicate for ...
by vvhitevvizard
10 Dec 2018, 13:39
Forum: Ask For Help
Topic: a few bugs?
Replies: 5
Views: 939

Re: a few bugs

guest3456 wrote:
06 Dec 2018, 21:47
nice. making a bitcoin trading bot?
not a bot. trade tool. sort of. ;)

btw the issue (bug or feature?) with AHK being no respecter of the custom background continues with custom foreground colors as well.
by vvhitevvizard
10 Dec 2018, 13:20
Forum: Ask For Help
Topic: AHK v2: question about enumerating
Replies: 4
Views: 479

AHK v2: question about enumerating

1. R there new ways in AHK v2 to distinguish between [] and {} types of user-created objects? a:=0 for i in object ;throws exc here if its not an object or doesn't have _NewEnum() method. if(!(a:=i=A_Index)) ;a=0:associative (have pairs "key":value) or sparse array ([1,,3]) break so knowing which a...
by vvhitevvizard
07 Dec 2018, 12:07
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

If you use one root object to store all the data you could access it all with the variadic parameter syntax. Good solution as well! We get rid of outdated %deref% syntax this way! It would be possible to wrap up all class prototypes and other globals, but that increases code size. Is it possible fo...
by vvhitevvizard
06 Dec 2018, 20:28
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

just wow! U've come back with a really handy one
by vvhitevvizard
06 Dec 2018, 19:33
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

You can wrap it in a function, too if you use it a lot. Here is the wrapped function as u suggested. :D Here we go into another trouble : when Name2Addr() returns the reference, that's not the original value's address: class a1 { static Key1:= "some string" static Key2:= "another string" class test...
by vvhitevvizard
06 Dec 2018, 19:12
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

oif2003 , now I see parts* as a "variadic-dimensional" array, stupid me @ 3am =) A very handy cycle for dereffing nested objects! and it does work in v2 . But %objname% deref is still there. It was my afterthought 2nd question in the topic; do u have any ideas how to do it w/o deref? There r quite ...
by vvhitevvizard
06 Dec 2018, 18:45
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: Problems with objects and legacy syntax Topic is solved

thx for ur feedback. yeah, ur weird code does work in AHK v2 but it makes things even more complicated. and we still use %deref% here. and tbh I don't get what is parts * - haven't they removed * (pointer operator) long time ago? :D PS: What I meant is need for some kind of built-in function to conv...
by vvhitevvizard
06 Dec 2018, 14:57
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

Re: a few bugs Topic is solved

Those are not bugs at all. I will move the post to the Ask for help forums. I see. But is there a way to get rid of %deref% syntax and use something like (I know * (pointer operator) was removed in AHK v2): for i,k in [a1.Key1, a1.Key2] ;array with prototype class members *k:="new value" Once again...
by vvhitevvizard
06 Dec 2018, 14:27
Forum: Ask For Help
Topic: AHK v2: converting/optimizing scripts Topic is solved
Replies: 266
Views: 22607

AHK v2: converting/optimizing scripts Topic is solved

We discuss multiple AHK v2 issues here. Converting from AHK v1.1, optiming for performance and code size. Chime in! page 1: using %% operator to deref "obj1.objN.key" stringified objects page ~5: super-optimized json in-out function. page 8: pretty-printing of stringified Float numbers. alternative...
by vvhitevvizard
06 Dec 2018, 12:44
Forum: Ask For Help
Topic: a few bugs?
Replies: 5
Views: 939

Re: a few bugs

Regardless of the value of StartingPos, the return value is always relative to the first character of Haystack. For example, the position of "abc" in "123abc789" is always 4. Ah I see. :D Thank u for quick reply! I updated 1st post with the snippet and new screenshot. Old ListView focus position is...
by vvhitevvizard
06 Dec 2018, 12:39
Forum: Ask For Help
Topic: a few bugs?
Replies: 5
Views: 939

a few bugs?

bug 1 I'm not sure if the bug exists in AHK v1.1. Negative StartingPos for InStr: msgbox(InStr("4111.3",".",,-1)) ;says [b]5[/b] instead of [b]2[/b] ;If StartingPos is negative, the search is conducted in reverse (right-to-left), ; starting at that position from the right. For example, -1 starts at...

Go to advanced search