AutoHotkey Community

It is currently May 27th, 2012, 1:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2

Do you want to see double-deref removed in AutoHotkey v2?
Yes
No
Don't care
You may select 1 option

View results
Author Message
 Post subject:
PostPosted: January 2nd, 2012, 4:47 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
fincs wrote:
The real question is whether dynamic variables are still worth it or not.
Not really. As long as Gui variables exist, so will dynamic variables. I have no intention to redesign the Gui commands.
Quote:
Ok, but it still itches my mind to talk about something that is not technically true (at least for now).
So what is the difference between a function and a command? They are implemented differently, but so are built-in functions and user-defined functions, or control flow statements and other commands. If a change in implementation does not effect a change in usage, is the implementation even relevant? Are we discussing the current incomplete v2 alpha, or what we want v2 to become?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 2nd, 2012, 7:30 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
I tend to loop csv column names and set them to named column ordinals

BS Code example
Code:
columnnames := "firstname,lastname"
loop,parse,columnnames,`,
%a_loopfield% := a_index
exl := comobjget("c:\test.xlsx")
exl.activesheet.cells(firstname ",2").value := "tom"


that way no mater the order of the columns sent to me the script correctly interprets data fill or read. there is a value to this level of simplicity

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 5:08 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
I don't like the DoubleDerefs/Dynamic Variables, but as long as there are "Commands" in the Syntax, I don't see any reason to remove them.

Remove this concept completely or let it be.

Commands provide under some circumstances simpler Syntax. Saying commands, especally the handling of gui commands, are noobfriendly is not that prooven as some people say. In my expirience this is something which can be truly improoved.

Quote:
As long as Gui variables exist, so will dynamic variables. I have no intention to redesign the Gui commands.


Using Commands to create a LV but being forced to use Functions to handle it is far away from being consistent. Using Commands with strange syntax to modify a Control is also far away being noobfriendly.

This is one part about usage. The other part about commands and the Gui handling is, it is very inflexible for advanced users. Guis and Controls should be Objects, which provides much better data structures. We can have a List of Controls - we can easy write some Layout-Manager for controls, as a Pane has a list with Child-Controls etc.

To not confront newbies with objects, one can provide a intuitive Syntax to handle them.

Creating a Gui without functionality is somewhat nice the way it is.
But if it comes to defining behaviors/actions like change something, it's getting very weird and unintuitive.
Code:
Gui, add, Edit, w100 vmyText
Gui, add, ListView, w200 h300 vmyLV, Name|Age
Gui, show, ,Title

addTextAndRows()

return

addTextAndRows(){
global    ;
    LV_Add("","Eric", 22) ; which LV!?
    GuiControl,,myText, Max  ; two commas? GuiControl?
}


An OOP replacement takes out a lot of the magic. The following example can be combined with better and shorter syntax off course.
Code:
myText := Edit(100)

myLV :=  ListView(200,300)
myLV.addColumn("Name")
myLV.addColumn("Age")

myGui := Gui("Title")
myGui.add(myText)
myGui.add(myLV)
myGui.Show()

addTextAndRows()
return

addTextAndRows(){
global   
    myLV.addRow("","Eric", 22)
    myText.Text := "Max"
}

The point is, as an User I want to have a EditBox. I want to take this thing and do whit it whatever I want. This is the way humans work. We think in Objects, not in Functions ;)

Using Objects is very intuitive, even for newbies. Objects are here to make things easier. Objects are much more "real" Things and therefore easier to understand for humans Writing Objects yourself isnt noob friendly, but is not required.

Setting the Value of a Text-Box is so much easier to understand, if you can say: "Well I have a TextBox called myedit and I want to set its text;
Code:
GuiControl,,myText, Max
;vs
myText.Text := "Max"

This looks much simpler, no external Function is needed.


Quote:
So what is the difference between a function and a command

They have different usage as functions. A User has to learn two things instead of one. Commands even are implemented a way which forces you to lookup their documentation to guess if an Expression or traditional String is expected.


About your clipboardall discussion. Whats the point? The Clipboard is an static Class/prefixed Function-Collection , which may have an method getBinaryData() for advanced useres.
Code:
bin := Clipboard.BinaryData
;..somewhere else
Clipboard.BinaryData := bin

Clipboard.setText("Hello World")

Where "bin", which is a copy of the current Clipboard-Data, itself is a datastructure - be it a byte Array or a simple AHK Object which provides a possibility to get a pointer to the start.

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Last edited by IsNull on January 7th, 2012, 10:29 am, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 5:14 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
IsNull wrote:
Using Objects is very intuitive, even for newbies. Objects are here to make things easier. Objects are much more "real" Things and therefore easier to understand for humans ...

I agree with this. IMO, objects need to become integrated into the AHK more fully - including the training. Objects should be the next step after variables - essentially a slightly more powerful variable (newb thought process). Once the AHK community becomes as comfortable with objects as they are with variables, then the discussion to remove double-derefs could be had. Until then I cannot justify limiting varaible usage.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 1:46 pm 
Sometimes I use it for a recursive function.
Code:
msgbox % RecursiveFunc(3)

RecursiveFunc(depth) {
   static data
   if (depth = 0)
      return

   data .= "edited`n"
   
   %A_ThisFunc%(depth-1)
   
   return data
}
Besides that, I remember I found it useful a number of times. I'll post more examples when I recall it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 2:31 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
That isn't a double-deref. It just looks similar.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 2:45 pm 
I may be misunderstanding the meaning of double-reference then.

Is this a double-reference?
Code:
varred := "FF0000"
color := "red"
msgbox % var%color%

And isn't this a double-reference?
Code:
red := "FF0000"
color := "red"
msgbox % %color%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 4:20 pm 
Online
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
@Guest: Both are double-derefs, since they make AutoHotkey dynamically look up a variable at runtime.

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 5:43 pm 
Then isn't %A_ThisFunc% a double-deref? :?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 27th, 2012, 5:59 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
Anonymous wrote:
Then isn't %A_ThisFunc% a double-deref? :?


No. The way you're using it is just a dynamic call, which is not the same as a double dereference.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You can 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