AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

AutoHotkey_L: Arrays, Debugger, x64, COM, #If expression ...
Goto page Previous  1, 2, 3 ... 53, 54, 55 ... 68, 69, 70  Next
 
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Mystiq



Joined: 08 Jan 2007
Posts: 83

PostPosted: Sun Sep 05, 2010 1:21 pm    Post subject: Reply with quote

Thanks for the update Exclamation
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Mon Sep 06, 2010 8:23 am    Post subject: Reply with quote

Thx for static update. Its finally like it should be.
_________________
Back to top
View user's profile Send private message
TheGood



Joined: 30 Jul 2007
Posts: 580

PostPosted: Mon Sep 06, 2010 2:32 pm    Post subject: Reply with quote

Shocked

Awesome updates!
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Mon Sep 06, 2010 3:15 pm    Post subject: Reply with quote

So, I can have N autorun sections:

Code:
AutoRunSection1()
{
   static _ := AutoRunSection1()
   msgbox %A_ThisFunc%
}


AutoRunSection2()
{
   static _ := AutoRunSection2()
   msgbox %A_ThisFunc%
}


...

AutoRunSectionN()
{
   static _ := %A_ThisFunc%()   ;this doesn't work.
   msgbox %A_ThisFunc%
}

Perhaps this could be added as extra keyword, for instance "autorun". This way the purpose is much more clear.

Code:
AutoRunSection1()
{
     autorun
     msgbox %A_ThisFunc%
}

_________________
Back to top
View user's profile Send private message
RUBn



Joined: 21 May 2007
Posts: 33

PostPosted: Mon Sep 06, 2010 6:32 pm    Post subject: Memory Reply with quote

  • [Great work!!
  • Any plans in the future to lower the footprint? It takes about double of memory for the standard script compared to Autohotkey. It's not the most important thing, but I was wondering if this is the result of it being fresh and that it might get a footprint improvement update or not..
Back to top
View user's profile Send private message
Mystiq



Joined: 08 Jan 2007
Posts: 83

PostPosted: Mon Sep 06, 2010 9:33 pm    Post subject: Reply with quote

Wondering why the following two ways of setting value do not work the same?

Code:

obj := Object()
obj.test.var := "does not work"
obj["test", "var"] := "works"


This was a bit of a "trap" for me because you can get the value using the "dot syntax" but not set it. The later method apparently works because it creates the "sub-objects" as necessary while the first one does not. Am i wrong to assume that it would be more "newbie" friendly (like me) for the first method to work equal to the second?

If i'm sounding confused, it is because i am. Wink
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Mon Sep 06, 2010 9:48 pm    Post subject: Reply with quote

majkinetor wrote:
static _ := %A_ThisFunc%() ;this doesn't work.
The function isn't running when the static initializer is evaluated. Static initializers are simply prepended to the auto-execute section (after variable references are resolved).
Quote:
Perhaps this could be added as extra keyword, for instance "autorun".
Auto-execution isn't the main reason for static initializers, but since it works, I'd rather not add any new syntax.

RUBn wrote:
Any plans in the future to lower the footprint?
No.
Quote:
It takes about double of memory for the standard script compared to Autohotkey.
I don't know what you call a "standard" script. For AHKControl, I see about 100KB higher Working Set size and roughly the same Private Working Set. I couldn't test my other "resident" scripts since they rely on AutoHotkey_L features. For a mostly empty script #including CLR.ahk and COM.ahk, the increase is 1MB / 600KB on the Unicode build and 300KB / 300KB on the ANSI build. Strings in the Unicode build necessarily take up twice as much memory; that's the cost of Unicode support. Also, it's my understanding that the Working Set is shared with other processes.

Note that whichever build you use, memory usage is slightly lower if you decompress AutoHotkey.exe (upx.exe -d AutoHotkey.exe), except for the x64 build, which can't be (easily) decompressed.
Quote:
It's not the most important thing, but I was wondering if this is the result of it being fresh and that it might get a footprint improvement update or not..
AutoHotkey_L is still mostly AutoHotkey, so there isn't much room for improvement. If I see any opportunities, I'll take them (within reason).

Mystiq wrote:
Am i wrong to assume that it would be more "newbie" friendly (like me) for the first method to work equal to the second?
Maybe, but it's not feasible. Would it be more "newbie" friendly for neither one to do anything automatic? My reasoning was that x[y,z] looks like multi-dimensional array syntax, so should act like it. See Arrays of Arrays.
Code:
;pseudo-code

obj.test.var := "abc"
; resolves to two separate actions:
temp := _objget(obj, "test")
_objset(temp, "var", "abc")

obj["test", "var"] := "abc"
; resolves to one action:
_objset(obj, "test", "var", "abc")

obj.test["var"] := "abc"
; is the same as the one above
Back to top
View user's profile Send private message Visit poster's website
rousni



Joined: 23 Mar 2006
Posts: 126

PostPosted: Wed Sep 08, 2010 1:06 pm    Post subject: two issues Reply with quote

1.

Code:
FOLDER = %A_ScriptDir%\DATA
If (FOLDER <> "%A_ScriptDir%\DATA") And (VAR = "")
   MsgBox BUG ?


2.
Any compiled script (from the last 3 versions): TR/Dropper.Gen
(I know this is the AntiVir problem, but even so...
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Sep 08, 2010 1:22 pm    Post subject: Reply with quote

OOPS!!
The correct one
Code:
FOLDER = %A_ScriptDir%\DATA
If (FOLDER <> A_ScriptDir . "\DATA") And (VAR = "")
   MsgBox BUG ?
Back to top
rousni



Joined: 23 Mar 2006
Posts: 126

PostPosted: Wed Sep 08, 2010 1:24 pm    Post subject: Reply with quote

Thank you !
Back to top
View user's profile Send private message
Mystiq



Joined: 08 Jan 2007
Posts: 83

PostPosted: Wed Sep 08, 2010 8:15 pm    Post subject: Reply with quote

Lexikos wrote:

Mystiq wrote:
Am i wrong to assume that it would be more "newbie" friendly (like me) for the first method to work equal to the second?
Maybe, but it's not feasible. Would it be more "newbie" friendly for neither one to do anything automatic? My reasoning was that x[y,z] looks like multi-dimensional array syntax, so should act like it. See Arrays of Arrays.
Code:
;pseudo-code

obj.test.var := "abc"
; resolves to two separate actions:
temp := _objget(obj, "test")
_objset(temp, "var", "abc")

obj["test", "var"] := "abc"
; resolves to one action:
_objset(obj, "test", "var", "abc")

obj.test["var"] := "abc"
; is the same as the one above


Being automatic seems better as it is more obvious i think.

Is there other language(s) that have similar implementation of objects as you have done for AHK_L? If this is a dumb question, don't hesitate to say so. Smile

Thanks!
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Wed Sep 08, 2010 8:23 pm    Post subject: Reply with quote

AHK_L object model is inspired by Lua programming language (see tables and metatables). AHK_L Get is equivalent to Lua's index, Set equals to newindex and Call is in Lua named the same. AHK_L adopted only those basic metatable operators while Lua has many of them, for instance math operators that give object meaning in usual mathematical context.

I already proposed that AHKL should follow Lua completely in this manner, however, Lexikos doesn't seem interested for now. Altho I don't agree I can understand his choice due to the big difference between those langugages - Lua is general purpose scripting language while AHKL is domain specific one and its accent is not on the language sophistication but on automation and easy to use features. Also, AHKL must maintain AHK legacy for script compatibility and vanilla AHK is pretty much one of the worst languages around.
_________________


Last edited by majkinetor on Thu Sep 09, 2010 9:39 am; edited 14 times in total
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7299
Location: Australia

PostPosted: Wed Sep 08, 2010 9:31 pm    Post subject: Re: two issues Reply with quote

Quote:
(I know this is the AntiVir problem, but even so...
What do you expect me to do about it?
Back to top
View user's profile Send private message Visit poster's website
rousni



Joined: 23 Mar 2006
Posts: 126

PostPosted: Thu Sep 09, 2010 6:05 pm    Post subject: Reply with quote

Quote:
Quote:
(I know this is the AntiVir problem, but even so...

What do you expect me to do about it?


To let me hope that maybe that wouldn't be the case in a futur version of AutoHotkey_L (like before the last three versions); otherwise it doesn't make much sense for me to only script for myself!
Back to top
View user's profile Send private message
rousni



Joined: 23 Mar 2006
Posts: 126

PostPosted: Sun Sep 12, 2010 11:32 am    Post subject: File Object and Inserting text Reply with quote

File Object doesn't provide an immediate interface for inserting/deleting text in a file, so I did the following:

Code:
file := FileOpen("filename.txt", "rw")
File.Seek(540)
string := "< inserted text >" . File.Read()
File.Seek(540)
File.Write(string)


It works but the fact that File.Seek(540) must be used twice make me doubt this is optimal (?)
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 53, 54, 55 ... 68, 69, 70  Next
Page 54 of 70

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group