https://wiki.beyondunreal.com/w/index.php?action=history&feed=atom UnrealScript compared with other languages - Revision history 2017-11-18T09:33:34Z Revision history for this page on the wiki MediaWiki 1.25.1 https://wiki.beyondunreal.com/UnrealScript_compared_with_other_languages?diff=42516&oldid=prev Wormbo: /* UnrealScript vs. C++ */ functions are virtual by default 2010-02-04T23:28:46Z <p>‎<span dir="auto"><span class="autocomment">UnrealScript vs. C++: </span> functions are virtual by default</span></p> <table class='diff diff-contentalign-left'> <col class='diff-marker' /> <col class='diff-content' /> <col class='diff-marker' /> <col class='diff-content' /> <tr style='vertical-align: top;'> <td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td> <td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 23:28, 4 February 2010</td> </tr><tr><td colspan="2" class="diff-lineno" id="L29" >Line 29:</td> <td colspan="2" class="diff-lineno">Line 29:</td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Up to [[Unreal Engine 2]] there is no built-in preprocessor support in UnrealScript. There are a few third-party preprocessor tools, though.</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Up to [[Unreal Engine 2]] there is no built-in preprocessor support in UnrealScript. There are a few third-party preprocessor tools, though.</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* UnrealScript only supports single inheritance and all classes ''must'' have a parent class, except for class Object, the upper-most class in the hierarchy. In [[Unreal Engine 3]] you can define and implement common [[interfaces]] for otherwise unrelated classes to declare common function prototypes.</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* UnrealScript only supports single inheritance and all classes ''must'' have a parent class, except for class Object, the upper-most class in the hierarchy. In [[Unreal Engine 3]] you can define and implement common [[interfaces]] for otherwise unrelated classes to declare common function prototypes.</div></td></tr> <tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* Functions can only be overridden, not overloaded.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* Functions can only be overridden, not overloaded<ins class="diffchange diffchange-inline">. They are virtual by default, unless declared ''final''</ins>.</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Operators can be overloaded, but not overridden. Only a fixed set of operator symbols are available, but operators can also be identifiers. Regular operators must have exactly two parameters and are always used in [[wp:infix notation|infix notation]] (i.e. like &quot;a + b&quot;), prefix and postfix operators always have exactly one parameter.</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* Operators can be overloaded, but not overridden. Only a fixed set of operator symbols are available, but operators can also be identifiers. Regular operators must have exactly two parameters and are always used in [[wp:infix notation|infix notation]] (i.e. like &quot;a + b&quot;), prefix and postfix operators always have exactly one parameter.</div></td></tr> <tr><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* UnrealScript has no constructor or destructor methods. Object initialization happens automatically and in most cases certain special methods are called automatically. Object destruction happens implicitly through the garbage collector. Actor subclasses are destroyed explicitly during the game and implicitly at map change. Before explicit destruction, the Destroyed() method of the destroyed Actor instance is called.</div></td><td class='diff-marker'>&#160;</td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>* UnrealScript has no constructor or destructor methods. Object initialization happens automatically and in most cases certain special methods are called automatically. Object destruction happens implicitly through the garbage collector. Actor subclasses are destroyed explicitly during the game and implicitly at map change. Before explicit destruction, the Destroyed() method of the destroyed Actor instance is called.</div></td></tr> </table> Wormbo https://wiki.beyondunreal.com/UnrealScript_compared_with_other_languages?diff=34379&oldid=prev Wormbo: Created page with '{{expand}} UnrealScript is a wp:curly bracket programming language|, so its syntax should look familiar to you if you already know other languages such as C++, Java, PHP or a...' 2009-05-01T11:57:00Z <p>Created page with &#039;{{expand}} UnrealScript is a <a href="http://en.wikipedia.org/wiki/curly_bracket_programming_language" class="extiw" title="wp:curly bracket programming language">wp:curly bracket programming language</a>, so its syntax should look familiar to you if you already know other languages such as C++, Java, PHP or a...&#039;</p> <p><b>New page</b></p><div>{{expand}}<br /> UnrealScript is a [[wp:curly bracket programming language|curly bracket programming language]], so its syntax should look familiar to you if you already know other languages such as C++, Java, PHP or any ECMAScript dialect, such as JavaScript or ActionScript.<br /> This article will shed some light on the differences between UnrealScript and other languages, especially the ones mentioned above.<br /> <br /> ==Unique UnrealScript features==<br /> One of the unique language features in UnrealScript are [[states]], which can be used to implement different behavior in the same class, depending on the current situation.<br /> <br /> Another feature is the [[defaultproperties]] block, which specifies the initial values for newly-declared and inherited variables alike. Starting with [[Unreal Engine 2]] this defaults block can be used to create object instances at compile time.<br /> <br /> UnrealScript also allows (and requires) you to define server-client communication ([[replication]]) at the language level.<br /> <br /> ==UnrealScript vs. Java==<br /> UnrealScript's entire design was originally based on [[wp:Java (programming language)|Java]], so it's not surprising that both languages are quite similar.<br /> <br /> Main differences:<br /> * UnrealScript is a completely case-insensitive language: Identifiers (variable/function/class names) and keywords make no difference between upper- and lower-case letters.<br /> * Only exactly one class definition is allowed per UnrealScript source file. The declared class name and the file name (without extension) must match.<br /> * There is only a single &quot;layer&quot; of packages and all classes must be contained in a named package. Unreal packages can also contain other objects, such as textures and sounds, or even entire levels. Packages are always compiled as a whole and end up being a single file.<br /> * There are no &quot;import&quot; statements in UnrealScript. If another package is required by a class in the package to compile, that package must be loaded at compile time, which is usually done through the [[INI file]] entry &quot;EditPackages&quot; or ModPackages&quot;.<br /> * Classes must specify which parent class they extend, even if it's just the Object class itself. Interfaces are only available starting with [[Unreal Engine 3]].<br /> * The type [[string]] is a primitive data type, while in Java strings are actually instances of the ''java.lang.String'' class. Also, there are no object versions of the primitive UnrealScript data types.<br /> * UnrealScript does not allow method overloading, only overriding. When overriding UnrealScript methods, it is not allowed to &quot;narrow&quot; the return type to a more derived class. You can declare and overload [[operators]] in UnrealScript, though.<br /> * UnrealScript knows two array types, [[static arrays]] and [[dynamic arrays]]. The length of static arrays is defined at compile time and cannot be changed at runtime. Dynamic arrays on the other hand are much like Java's ''java.util.ArrayList'' class, except that dynamic arrays are no objects, but can also be used with a primitive inner type. UnrealScript does not allow arrays of type [[bool]] and does not support multi-dimensional arrays.<br /> * UnrealScript doesn't support generics, annotations or exception handling. Things like ''NullPointerException'' or ''IndexOutOfBoundsException'' are handled gracefully in UnrealScript by just returning null values after writing a warning message to the log file. [[Typecasting]] object references is safe and also works for empty references.<br /> <br /> ==UnrealScript vs. C++==<br /> Apart from the many Java-like features, UnrealScript also borrows some features from [[wp:C++|C++]], for example operator definitions.<br /> * All UnrealScript code must be contained in classes. There are no global functions, variables or constants.<br /> * Up to [[Unreal Engine 2]] there is no built-in preprocessor support in UnrealScript. There are a few third-party preprocessor tools, though.<br /> * UnrealScript only supports single inheritance and all classes ''must'' have a parent class, except for class Object, the upper-most class in the hierarchy. In [[Unreal Engine 3]] you can define and implement common [[interfaces]] for otherwise unrelated classes to declare common function prototypes.<br /> * Functions can only be overridden, not overloaded.<br /> * Operators can be overloaded, but not overridden. Only a fixed set of operator symbols are available, but operators can also be identifiers. Regular operators must have exactly two parameters and are always used in [[wp:infix notation|infix notation]] (i.e. like &quot;a + b&quot;), prefix and postfix operators always have exactly one parameter.<br /> * UnrealScript has no constructor or destructor methods. Object initialization happens automatically and in most cases certain special methods are called automatically. Object destruction happens implicitly through the garbage collector. Actor subclasses are destroyed explicitly during the game and implicitly at map change. Before explicit destruction, the Destroyed() method of the destroyed Actor instance is called.<br /> * UnrealScript doesn't provide pointers. The memory addresses of values are not accessible. Arrays are explicitly declared as [[static array|static]] or [[dynamic arrays]]. Multi-dimensional arrays are not supported, but can be faked by using arrays or structs containing array members.<br /> * The conditions in [[If statement]]s and [[While loop]]s are required to be of the type [[bool]]. Other types are ''not'' converted to boolean values automatically.<br /> * [[Structs]] are not public classes, they are really just collections of variables.<br /> * The values of enum constants are hidden in UnrealScript. Implicitly they correspond to the byte values 0, 1, 2, ... in the same order as they were defined.<br /> <br /> [[Category:Programming articles]]</div> Wormbo