Quote:
Originally Posted by Gunderak
I still hate the whole object:type thing. Would love it if it was more like Java and C#, object something;
|
Hello,
By essence, GScript is a scripting language. GScript is more close to JavaScript-like languages, rather than Java or C#.
This type syntax was chose among other language syntaxes, because it is commonly-used to annotate types in ECMAScript-based languages.
For example:
HTML Code:
// ActionScript
function foo(a:int):int {...}
// TypeScript
function foo(a: number): number {...}
// UnityScript
function foo(a : int) : int {...}
// Haxe
function foo(a : Int) : Int {...}
So, when converting from GS2 syntax to GS3 syntax, you just have to add type annotations to the original syntax.
HTML Code:
//#GS2
function foo(a) {...}
//#GS3
function foo(a : int) : int {...}
With a Java or C# syntax, this will require more semantic changes to the language, like removing the "function" keyword.
Also, you lose the ability to easily import scripts from similar languages (ActionScript, JavaScript, UnityScript, TypeScript...).
HTML Code:
// Java or C#.
int foo(int a) {...}