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: 9583
Joined: 30 Sep 2013, 04:07
Contact:

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: 9583
Joined: 30 Sep 2013, 04:07
Contact:

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: 8951
Joined: 29 Sep 2013, 17:08
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, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
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
Contact:

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: 8951
Joined: 29 Sep 2013, 17:08
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, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 49 guests