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 

Constructive Language Criticism & Script Merging

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Mon Jul 03, 2006 12:10 pm    Post subject: Constructive Language Criticism & Script Merging Reply with quote

After several personal messages with the author, I wrote this article to adress some issues in the current AHK language.

Then I explain script merging technique, several times discussed on the forum already.

In the archive is the 30 page article and examples used as a proof of a concept.

I hope that you will find this useful.



    Download                          Read



Note about included scripts:

1. Favmenu is Open/Save dialog enhancer. It will change the directory in any standard open/save dialog. For more details and full documentation see: http://www.ghisler.ch/wiki/index.php/Features_and_Installation

2. Editor is Favmenu's menu editor.
3. Parent is merged script that contains 1 & 2

_________________


Last edited by majkinetor on Tue Jul 04, 2006 1:43 pm; edited 7 times in total
Back to top
View user's profile Send private message MSN Messenger
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Mon Jul 03, 2006 12:34 pm    Post subject: Reply with quote

2 corrupt

corrupt wrote:
majkinetor: Out of curiosity, do you have a workiing prototype? I had tried something similar and got a couple access errors from AutoHotkey.


Read the script merging part of the article.
_________________
Back to top
View user's profile Send private message MSN Messenger
corrupt



Joined: 29 Dec 2004
Posts: 2419

PostPosted: Mon Jul 03, 2006 9:25 pm    Post subject: Reply with quote

Hi majkinetor,

An interesting read Smile . In general, I don't have much of a need to merge scrips since I usually create scripts for very specific purposes. For this reason, I have a menu script that launches/terminates specific scripts when needed that is activated from a hotkey.

It sounds like your work could provide a solid foundation for creating a script that can parse existing scripts and create plugin compatible scripts then optionally merge them with other scripts. I'm sure many people would be interested in such a script. This way someone could pick a few of their favorite scripts and have a master script automatically generated for them Smile .


A few comments on your well documented Constructive Language Criticism:

labels - not being restricted on where jumps are allowed allows more flexibility in writing scripts. The responsibility is on the person creating the script to avoid jumps that may cause internal issues

whitespace - The example you gave is a fairly obvious syntax error to me but may not be obvious to others... AFAIK this alternative works ok:
MyFunction(){
global
...
}

Your variable example: s := s . "new text" . p is valid so why not just use that method if you find the difference to be trivial?

You may be overlooking that the 2 ways of assigning variables play an important role in syntax for being able to create/modify variables dynamically.

arrays - I agree that the current global/local declarations in functions aren't very flexible when using functions but I'm guessing that it likely won't be an issue when true arrays are implemented. Adding syntax as a workaround doesn't seem worthwhile IMO.

Strings - There are a few methods available for accessing string characters at a specific offset. Wrapper functions for StringMid, StringLeft, etc... would be nice but are simple to add to a script.

Commands with the same meaning - I also prefer to use expressions in most cases but the simplicity and flexibility of the other commands is also very appealing. Actually, it was the simplicity of those commands that attracted me to start using AutoHotkey to begin with. I think it's much easier for beginners to learn and allows flexibility in various commands.
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Tue Jul 04, 2006 8:13 am    Post subject: Reply with quote

hi corrupt

Quote:
labels - not being restricted on where jumps are allowed allows more flexibility in writing scripts. The responsibility is on the person creating the script to avoid jumps that may cause internal issues

Chris asked me what is contraintuitive. Personally, I like less limits but, this is contraintuitive, after learning several other languages

Quote:
whitespace - The example you gave is a fairly obvious syntax error to me but may not be obvious to others

That is the point. It is obvious to experience users but not obvious to novice users. When I was novice AHK user, I had many problems with this in my scripts until I finaly got what is going on.

The example I gave was intentionaly syntax error, to present what you can not do.

Quote:
You may be overlooking that the 2 ways of assigning variables play an important role in syntax for being able to create/modify variables dynamically.

I don't understand you here... Please explain what you can do with one syntax that you can not with other ?

Quote:
arrays - I agree that the current global/local declarations in functions aren't very flexible when using functions but I'm guessing that it likely won't be an issue when true arrays are implemented.

I don't know anything about "true arrays" ? I was talking about current implementation.

Anyway, the point of the text lay in script merging technique.
I doubt that parser you mention can be created, and if can, that work certanly is not a trivial task. You are actually suggesting the same as I did, but with slightly different approach - parsing existing scrpts vs language constructs. Adding few language constructs could solve many problems here, and mulitithreading wuold be major benefit (but this is hard to implement). But parser can not be created since some things in AHK prevents you to do that with 100% certanty, without witch this parser is just another disaster since you acctualy can't know if script was parsed correctly and in what area might be the problem. Some things can not be isolated from other scripts at all, like #NoEnv, and possibly many others.

Foundation exists for another thing, AHK developer!
Developer that will create in background parts of merging scheme for you like higher level IDEs: when you create a GUI all those variables and message handlers could be created automaticaly. Then you may have dozen of events that you could just click to start writting the handler etc..

Also imporatant, I find this script much easier to follow and correct the errors since variables are isolated, and functionalities are also encapsulated in various scirpt parts.

NOTE: This article contains foundations for merging. Not all problematic issues are covered, just most important. This topic is open for suggestions and critics if you have them.
_________________
Back to top
View user's profile Send private message MSN Messenger
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Tue Jul 04, 2006 1:34 pm    Post subject: Reply with quote

I added page to my server so if you want to read you can click the Read link in the first post. To download with included scripts that are proof of a concept, use Download link.

I also updated Wiki->Documentation->Tutorials: http://www.autohotkey.com/wiki/index.php?title=Main_Page
_________________
Back to top
View user's profile Send private message MSN Messenger
Tester



Joined: 06 Jul 2006
Posts: 48
Location: Poland

PostPosted: Sun Jul 30, 2006 9:01 pm    Post subject: Reply with quote

I enhance this idea to modules auto-search and auto-load discussed here

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



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Mon Sep 04, 2006 3:02 pm    Post subject: Reply with quote

Sorry, I didn't see your post until today.

I will check it out.
_________________
Back to top
View user's profile Send private message MSN Messenger
Tester



Joined: 06 Jul 2006
Posts: 48
Location: Poland

PostPosted: Mon Sep 04, 2006 3:06 pm    Post subject: Reply with quote

No problem. I haven't not yet time to write code for files parsing, so at this time this is not yet working algorithm - it is only idea.
Regards.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
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