Haxe is a general-purpose language supporting object-oriented Unusual among programming languages, Haxe contains a type. Haxe is a feature-rich, high-level, Turing-complete programming language. It’s very generic, somewhat Java-like, but it also feels somewhat. While the modern programming language Haxe is well-known in some circles, many developers have never heard of it. Yet since it first appeared in
|Published (Last):||20 August 2008|
|PDF File Size:||19.24 Mb|
|ePub File Size:||6.39 Mb|
|Price:||Free* [*Free Regsitration Required]|
Haxe is a high-level cross-platform multi-paradigm programming language and compiler that can produce applications and source code, for many different computing platformsfrom one code-base.
Haxe includes a set of common functions that are supported across all platformssuch as numeric data typestextarraysbinary and some common file formats.
Haxe originated with the idea of supporting client-side and server-side programming in one language, and simplifying the communication logic between them. Many popular IDEs and source code editors have support available for Haxe development. The core functionalities of syntax highlightingcode completionrefactoringdebuggingetc. The comparison of IDE choices for Haxe programmers has quite in-depth information. Development of Haxe began in October Modern platforms such as C and Java were added with a compiler overhaul in Haxe was developed by Nicolas Cannasse and other contributors, and was originally named haXe because it was short, simple, and “has an X inside”, which the author asserts humorously is needed to make any new technology a success.
The Haxe compiler is an optimizing compilerand uses function inliningconstant foldingand dead code elimination DCE to optimize the run-time performance of compiled programs. This strategy of compiling to multiple source code languages is inspired by the write once, run anywhere paradigm.
It also allows the programmer to choose the best platform for the job. Typical Haxe programs run identically on all platforms, but developers can specify platform-specific code and use conditional compilation to prevent it from compiling on other platforms. Haxe has much in common with ActionScript 3.
What is Haxe? – Haxe – The Cross-platform Toolkit
The Haxe compiler is developed in the OCaml language. No knowledge of OCaml is needed to develop applications using Haxe. Advantages to using Haxe over ActionScript 3 include:.
Haxe is a general-purpose language supporting object-oriented programminggeneric programminglqnguage various functional programming constructs. Features such as iterationsexceptionsand code reflection are also built-in functions of the language and libraries. The compiler will check types implicitly languate give compile-time errors, but it also enables the programmer to bypass type-checking and rely on the target platform’s dynamic type-handling.
Since Haxe had its origins in ActionScript 3all of the languate Flash API can be used, although Haxe requires better-formed code and programming standards than Adobe compilers for example, regarding scoping and data typing.
Haxe has a sophisticated and flexible type system. The type kinds it offers are classes, interfaces, function-method types, anonymous types, algebraic data types ADTs, called enum in Haxeand abstract types. Parametric polymorphism is possible with classes, ADTs and function types, giving the language support for generic programming based on type erasure.
This includes support for variance programmkng polymorphic functionsalthough not in type constructors. The type system is static unless annotations for langjage typing are present, for use with targets that support them. Type checking follows nominal typing with the exception of anonymous types where structural typing is used instead. Finally, type inference is supported, allowing for variable declarations without type annotations.
Classes keyword class in Haxe are similar to those in Java or ActionScript 3. Their fields can be either methods, variables, or properties, each static or per instance respectively. Haxe supports the accessors public and privateand more advanced methods for access control ACL, link that are denoted using annotations.
Methods and static constant variables can be inlined using the progrramming inline.
Introduction to Haxe
Interfaces in Haxe are very similar to those in, for example, Java. Enumerated types are an important feature of the language; they can have type parameters and be recursive. A switch expression can apply pattern matching to an enum value, allowing for elegant solutions to complex programming problems:. Examples of progra,ming enum types are the Haxe standard library types Option  and Either: Haxe also supports generalized algebraic data types GADTs.
Anonymous types are defined by denoting their structure explicitly, using a syntax that follows the mathematical record-based representation of a type. They can be used to implement structural typing for function arguments see belowprgoramming can lznguage given an alias with the keyword typedef:. Functions are first-class values in Haxe. Their type is denoted by using arrows between argument types, and between the argument type s and return type, as common in many functional languages.
However, unlike in prominent examples like Haskell or the ML language family, not haxf functions are unary functions functions with one argument onlyand in Haxe, functions can’t be partially applied per default. Thus, the following type signatures have different semantics than llanguage the aforementioned languages. The type F is a function that takes an Int and a String as arguments, and returns a value of type Float.
Types F2 and F3 denote the same type.
Both are binary functions that return a binary function of type F. For F3 the syntax to declare a function type within a function type is used. The latest addition to the Haxe type system is a concept termed abstract types. As used in Haxe, this refers to something different from a conventional abstract type.
They are used to make conversions between types implicit, allowing reuse of existing types for specific purposes, like implementing types for units of measurement. This greatly reduces the risk of mixing up values of the same underlying type, but with different meanings e. The following example assumes that the metric system is the default, while a conversion to miles is needed programmin legacy data. Haxe can automatically convert miles to kilometers, but not the reverse. In many functional programming languages, structural typing plays a major role.
Haxe employs it in the presence of anonymous types, using the nominative typing of object-oriented programmingwhen only named types are involved.
Anonymous types in Haxe are analogous to the implicit interfaces of the language Go as to typing. In contrast with Go interfaces, it is possible to construct a value using an anonymous type. The Haxe compiler is divided into one frontend and multiple backends. The frontend creates an abstract syntax tree AST from the source code, and performs type checking, macro expansionand optimization on the AST.
The various backends translate the processed AST into source code or generate bytecodedepending on their target. The compiler is written in OCaml. It can langjage run in server-mode to provide code completion for integrated development environments IDEs and maintain a cache, to further speed compiling. In Haxe, supported platforms are known as “targets”, which are Haxe modules that provide access to core-APIs language and bytecode targetsfor the compiler-backends that are responsible for generating the respective code, and for runtimes with specific APIs that go beyond the core language support platform-targets.
From Wikipedia, the free encyclopedia. prpgramming
Haxe – Wikipedia
Not to be confused with Hack programming language. Date ; public var name: String ; public function age: L ; Right v: Int ; public var bar: Free and open-source software portal. Professional haXe and Neko. Support Haxe, save your Tools”. Chapter 9 Using Haxe. Archived from the original on Archived from the original on October 22, Haxe – The Cross-platform Toolkit.
Retrieved 30 April Adobe Flash Media Server. Retrieved from ” https: Object-based programming languages OCaml software Programming languages created in Software using the GPL license Source-to-source compilers Statically typed programming languages.
Official website different in Wikidata and Wikipedia. Views Read Edit View history.