Release of the programming language Haxe 4.1

Available toolkit release Hax 4.1, which includes the eponymous multi-paradigm high-level programming language with strong typing, a cross-compiler and a standard library of functions. The project supports translation to C++, HashLink/C, JavaScript, C#, Java, PHP, Python, and Lua, as well as compilation to JVM, HashLink/JIT, Flash, and Neko bytecode, with access to the native capabilities of each target platform. Compiler Code spreads licensed under the GPLv2, and the standard library and virtual machines developed for Haxe hashlink ΠΈ Neko under the MIT license.

Language is expression-oriented strongly typed. Object-oriented, generic and functional programming techniques are supported. Haxe syntax is close to ECMAScript and extends the its features such as static typing, type inference, pattern matching, generics, iterator-based "for" loop, AST macros, GADT (Generalized Algebraic Data Types), abstract types, anonymous structures, simplified array definitions, expressions for conditional compilation, attaching metadata to fields, classes and expressions, string interpolation ("'My name is $name'"), type parameters ('new Main ("foo")') and more.

class Test {
static function main() {
final people = [
"Elizabeth" => "Programming",
"Joel" => "Design"
];

for (name => job in people) {
trace('$name does $job for a living!');
}
}
}

New in version 4.1:

  • Added tail recursion optimization.
  • Added a new unified API for exception handling.
  • The construct "try {} catch(e) {}" is allowed as a shorthand for "try {} catch(e: haxe.Exception) {}".
  • SSL support has been added to the eval interpreter.
  • The JVM target platform is no longer considered experimental.
  • Added support for the "Goto Implementation" and "Find references" functions for the Language Server Protocol.
  • Improved naming of temporary local variables in generated code. Removed redundant "return;" in arrow functions with no return value.
  • Access combinations (get, default) are allowed on fields (only getter, default assignment behavior).
  • Allow increment and decrement operators for fields abstract types.
  • Improved inlining of for-loops using anonymous iterators.
  • js: Improved ES5 implementation of StringMap.
  • js: Added let variable generation to "-D js-es=6" compiler option, improved ES6 class generation.
  • lua: "StringIterator" optimized, error handling improved.
  • php: Optimized "Std.isOfType" for base types.
  • php: Generated arrays now implement native interfaces "Iterator", "IteratorAggregate", "Countable".
  • cs: Added "@:assemblyMeta" and "@:assemblyStrict" metadata.
  • python: implementation of "__contains__" added to anonymous objects
    and "__getitem__", which allows them to be used as dictionaries in the generated code.

  • jvm: Significantly improved performance with a new way of calling typed functions and generating additional interfaces in cases where objects are used as anonymous structures (dynamic property lookup is prevented):
    Release of the programming language Haxe 4.1

Improvements in the standard library:

  • Added "Array.contains" function.
  • Added "Array.keyValueIterator", which implements key-value iteration for arrays ("for (key => value in array)").
  • Added constraint of type "haxe.Constraints.NotVoid".
  • The "findIndex" and "foldi" functions have been added to the "Lambda" class.
  • Implemented "array access" (access via "arr[i]") and key-value iteration for "haxe.ds.HashMap".
  • jvm: Implemented JVM-specific versions of "StringMap", "sys.thread.Lock", "sys.thread.Thread".
  • java/jvm: Used native "MD5", "SHA-1" and "SHA-256" implementations for "haxe.crypto" modules.
  • macro: Added "haxe.macro.Context.containsDisplayPosition(pos)".
  • nullsafety: "Strict" mode is now treated as single-threaded; added "StrictThreaded" mode.
  • "Std.is" has been deprecated in favor of "Std.isOfType".
  • Added a warning when using local variables without values ​​in closures.
  • js: "untyped __js__(code, args)" has been deprecated, "js.Syntax.code(code, args)" is provided instead.
  • php/neko: "neko.Web" and "php.Web" have been deprecated and will be moved to the "hx4compat" library later.

In the next release are planned:

  • Package manager improvements haxelib.
  • Asynchronous system based API libuv.
  • Coroutines.
  • Declaring modular static functions and variables without creating classes (already available in nightly builds).

Source: opennet.ru

Add a comment