@SOTE
just lol @ labels being flexible. anything but. sure, for ur run-off-the-mill hotkey/hotstring scripts and toy gui scripts they might get the job done, but try doing anything even moderately more sophisticated than that and ur options are waste hours of ur life trying to come up with hacks to mold them to fit ur needs, and waste hours of ur life trying to come up with hacks only to realize what u need is actually impossible and be forced to give up
Goto has only
one legit use - breaking out of n-nested loops cleanly. if ure using
Goto for anything else other than that, do urself a favor,
Ctrl + A, Del and start over. ur future-self will love u for this.
discussions among old timer programmers or Assembly programmers, they are perfectly fine with Goto, Gosub, etc... in higher level languages.
so what? their being fine with it doesnt mean it should be used, especially not given the availability of more powerful constructs. noone in their right mind uses
Goto in lieu of
while loops, so why should this apply any differently to other cases(the cases being functions v. labels)
Labels are used with Gosub and Return. This makes them arguably as powerful as using functions, but easier to use and understand.
haha, nice try but no. only as powerful as a parameterless assume-global function.
vs
idk what kinda people u tried explaining this to, but u have to be a LITERAL baboon to not understand functions. u must have been explaining it wrong
And actually the script is less spaghetti
its absolutely, invariably more spaghetti. global state, namespace pollution, mutations all over the place, and u cant even know its happening unless u specifically check for it. delicious and a whole lotta fun! u might not think its a problem since u already know whats going on in the script, after all, it was u who wrote it. but give it to some other random person, ask them to make sense of ur
goto-carbonara main course and just watch them reach for the closest gun barrel to choke on.
To avoid function clutter, programmers will stuff a group of functions into a Class.
yes, functions will be stuffed into a class(which isnt the way its intended to be used) because AHK lacks namespaces(oh hey, heres a feature request for v2). what can one do to avoid label clutter, again?
liberal use of comments should be frowned upon, especially for the purposes of clarifying the behavior of built-in language constructs. yes, u could write a msg right before the
Goto:
"okay, listen up, the label requires a, b, c to even WORK PROPERLY(make sure those are defined prior to jumping, tee-hee), and mutates x, y, z which are scattered all over the rest of the script, in the global namespace ofc. have fun!". great, now u have actual code to maintain AND a comment to go with it. OOOOR u could just use a function instead - no comment needed, parameters are immediately visible, return values are immediately visible, and if u adhere to best practice coding standards which u should btw, ie no
global, u can be SURE of it, without even looking.
Allowing for different styles of programming, including what is easier, is an advantage of v1
no, no no no no, absolutely not. many ways to do similar(but not quite identical) things are absolutely detrimental to AHK's usability. take Traditional v. Expression syntax for example. u have a noob start off with traditional, he learns it fairly quickly, lets say. now time comes, turns out he needs to do something which traditional doesnt support, say, double-deref a variable or whatever. what happens next? great, now hes gotta spend time learning expression syntax. thats time wasting learning the parts already covered by traditional syntax and he'll be more prone to fukups in the long run, since he'll be more used to traditional syntax, and its likely his grasp of expression syntax will stay poorer for longer. Now, imagine a world where traditional syntax was pruned and all u had was expressions. He'd spend more time upfront(arguably tbh) learning expression syntax, but then he'd be set for life, he'd be able to do anything and everything with expression syntax alone. he would have to keep track of two things at the same time. u know, there's a reason why some languages(python comes to mind) strive toward coming up with the most idiomatic ways to write code. u dont praise cpp for its ease of use:
"just look how flexible it is, 20 or so ways of initializing stuff!! amazing!"
I don't see rigidness and unnecessarily eliminating features as being of value to most programmers.
eliminating redundant, inferior, superseded features is totally of value to most programmers. to those that were using them - they get to expand their horizons and learn of newer better ways of doing things; to those that werent using them - they get to avoid the pitfall of wasting their time learning them and becoming overly reliant on them; to those maintaining the language - theres now less to maintain; to those developing tooling for the language - also less to care about. Rigidity is not all bad stuff. Imagine if we had no commands, mandatory endofline delimiter, function keyword(var maybe too, or immutable), mandatory parens. my god, the kind of syntax highlighters u could write. linters, intellisense even maybe! what a world to live in!
I get that there was some "highbrow" insulting of v1 syntax,
command syntax is horrendous. its objectively bad, inferior, less flexible and promotes bad coding practices. proliferated
byref/
errorlevel usage(abuse really, lets call it what it is), wonky(or lacking) expression support. not convinced? go take a peek at some ol' AHK Basic scripts. if a thread from 2006 come up during research while im writing a script, just thinking about opening it sends shivers down my spine.
and $ spam syntax
$ spam syntax is shit, same as
%% spam syntax.
% is directionless and it totally is a problem. its ugly, its noisy, i dont care if Microsoft uses it and if they do, well, guess what? they made a mistake. Im indifferent towards
:= v
=. actually, scratch that,
:= is nice, it can stay.
@Klarion
totally agree, itd be absolutely ludicrous to rewrite v1 scripts in v2 just cuz. Especially so if they make heavy use of dllcalls, i wouldnt touch that with a 10 ft pole. The only people concerned with rewrites should be library authors.
@jeeswg
frankly, ur converter script idea to me seems like a pipe dream, and im not saying this to demotivate u, diminish ur accomplishments or discredit the work uve put in. i simply doubt the extent to which it will be of any use. presumably, it will be able to only somewhat translate v1 syntax to v2 syntax, 1:1. but will it be able to transform GUIs? will it be able to turn labels into lambdas, use nested functions etc, ie the things that make v2 v2? even if u were to somehow copypaste port v1's parser from source, expanding upon it to factor in conversions of this nature, seems like a super massive undertaking.
besides, theres no way in hell im running a converter script alone on a production script. id have to write or rewrite the tests for v2 first and then id have to still manually touch things up(cuz lets be real, no chance its gonna do a full 100% accurate conversion), at which point u have to wonder - why even bother with the conversion script? after its done, at best, ud have a v2 script written in v1 style, at worst, a non functional mess. Who is this tool even aimed at? Noobs? Unless its gonna do 100% accurate conversions, theyre gonna be stuck with a non working script, which theyll have to still learn and figure out how to fix themselves. Pros? Yeah, its probably gonna save them some time, maybe, but then again they could instead rewrite manually to better take advantage of v2's newer features.