Assorted & Unsorted AutoHotkey v2 Wish List

Discuss the future of the AutoHotkey language
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: Assorted & Unsorted AutoHotkey v2 Wish List

19 Jul 2014, 00:55

fincs wrote:Why can't you use functions with assume-global mode instead of subroutines? Also, nobody said anything about removing Goto (and in fact I also oppose its removal).
In DRAKON-AutoHotkey ( http://ahkscript.org/boards/viewtopic.php?f=6&t=3108 ) I cant use functions everywhere because in AutoHotkey not everything can be included in functions. I prefer to use code generation from diagram within function wherever it is possible. But when there is a code that can't be inside function I need to use Free type diagram, which allows code generation within label and return (Gosub), or within label and another goto (Goto). When you are calling Free type diagram with Gosub you just call diagram and it automatically return when diagram code executes(DRAKON Editor automatically generates return code at the exit of Free type diagram.). When you are calling Free type diagram with Goto then you have to manually add another Goto at the exit of the diagram and also somewhere else outside of that diagram label for that Goto. So, for Free type diagram, Gosub method for calling Free type diagram is much more convenient then Goto method. Gosub is perfectly suited for Free type diagrams. Please dont remove Gosub and Goto. They both are need for DRAKON-AutoHotkey to working properly.
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
lexikos
Posts: 6668
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Assorted & Unsorted AutoHotkey v2 Wish List

19 Jul 2014, 01:21

lexikos wrote:
fincs wrote:since all functionality that formerly used subroutines has been reworked to use functions,
Except for subroutines in functions...
toralf wrote:I think it is on of the simple concepts that makes AHK so attractive for beginners.
I think the concepts are pretty much the same for parameterless functions, just the syntax is different.
lexikos
Posts: 6668
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Assorted & Unsorted AutoHotkey v2 Wish List

19 Jul 2014, 02:10

kon wrote:But instead of eliminating the command, I think it is better to advise new users to use goto instead.
It is far better to teach the user how to correctly use functions.
User avatar
joedf
Posts: 7341
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Assorted & Unsorted AutoHotkey v2 Wish List

19 Jul 2014, 02:47

For reference:
Docs wrote:Although Gosub is useful for simple, general purpose subroutines, consider using functions for more complex purposes.
Docs wrote:The use of Goto is discouraged because it generally makes scripts less readable and harder to maintain.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: Assorted & Unsorted AutoHotkey v2 Wish List

19 Jul 2014, 03:05

lexikos
So, as I understand Gosub and Goto will not be removed in v2, right?
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
GitHub: cocobelgica

Re: Assorted & Unsorted AutoHotkey v2 Wish List

19 Jul 2014, 03:13

gosub and goto are still both useful especially with the way v2 handles local labels (you can use the same label names as long they are within different function scopes, no need to come up w/ unique label[for local labels only] names.). I use them to implement some sort of pseudo-closure.
User avatar
joedf
Posts: 7341
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Assorted & Unsorted AutoHotkey v2 Wish List

19 Jul 2014, 04:35

Cool! Didn't know
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 15 guests