Deprecated_GML - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
Mostly because GML is for novices and also for efficiency, some of GML's behaviours have been discarded.
Deprecated GM Functions can be found on the :Category:Function:Obsolete list.
Things we're never looking back at
This is so foul, no one wants to touch it (meaning, Josh doesn't)
for(;;;) Syntax
In GML, for (i = 0; i < 10; i += 1;) {}
is valid code, however, for (i = 0; i < 10; i += 1);
is not (in early versions, it passes the
syntax check but fails at tree build time during load). Additionally,
the following is
valid:
for ({statement1 = 0; statement2 = 0; statement3 = 0; i = 0;}; i < 10; {statement1 += 1; statement2 += 2; statement3 += 3; i += 1; }) {}
{{-}}
Stuff we might add a setting for
Some of these are useful to people and/or are easy to implement. They may be added if it's requested by someone in a pickle.
do
Syntax
Worthless In GML as of GM8, do
is extraneous when following with()
or
while()
. with(all) do { x += 1; } until (place_free(x,y));
is
therefore invalid. This was discarded.
var::operator* (int, string)
In GM8, 5 * "tree" yields "treetreetreetreetree". No one has yet
confirmed Rusky has confirmed this was the behavior in GM6
(Josh thought the opposite), and so it will probably be implemented as a
compatibility option. GM6 offers string_repeat in lieu of this
functionality, as does ENIGMA. A setting for this would entail only
keeping two separate object files for var4.cpp.
No short-circuiting
In GM, statements are not short circuited, in ENIGMA they are.
{{-}}
What may get put in a compatibility pass
TGMG wrote a regexer that takes care of some incompatibilities. Here we list incompatibilities that could possibly be added.
Comma-free declarations
GM doesn't care if you use commas in your declarations or not, and doesn't even make you end them with a semicolon,
var a b c, d e f, g h i
if (j == k + l) {}
so long as you don't assign to anything immediately afterward. This gives a syntax error:
var a b c
a = 10
Discarded. A regexer can add a comma after any variable following `var` (or other variables following it) which is not followed by a keyword. ENIGMA will correctly deal with the semicolon.
Delphi assignment in conditionals
if (a := b) {
}
Some disgusting animals are so convinced the equals operator is designed to both assign and compare that they actually use the strict Delphi assignment (:=) in conditionals to test them. A regexer could replace all := with = and let ENIGMA discern which it should be.
Hot lookup change for var
In GM, you can conditionally move the scope of a variable to the global or script-local scope by stating "globalvar var_name" or "var var_name", respectively. The latter is done at lex time, as soon as the statement is read. This means that var does not depend on scope in GML. In EDL, it is defined to by the C standard. Some 95 percent of use cases can be fixed by moving all var declarations to the top of the script.
Assigning to void function
In GM you can make assignments to a void returning function.
Semicolons, everywhere!
In GM, the semicolon is basically decoration between statements.
if (a) { ... }; ; ; ; ; ; else {}
is fine.
Regex replace any /}(((\s*);)+)/ with just "}" in a compatibility pass, and the main use-case is fixed.