# Haxe 4.0.0-preview.4 is released

**URL:** https://community.haxe.org/t/haxe-4-0-0-preview-4-is-released/769
**Category:** Announcements
**Tags:** release
**Created:** [June 12, 2018, 3:54pm UTC](https://community.haxe.org/t/haxe-4-0-0-preview-4-is-released/769 "2018-06-12T15:54:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pchertok](https://community.haxe.org/user_avatar/community.haxe.org/pchertok/32/822_2.png) [@pchertok](https://community.haxe.org/u/pchertok)
#### Post date: [June 12, 2018, 3:54pm UTC](https://community.haxe.org/t/haxe-4-0-0-preview-4-is-released/769/1 "2018-06-12T15:54:24Z")

</div>

Dear Community,

On behalf of the Haxe Foundation, we are proud to announce the official release of the Haxe 4.0.0-preview.4! It is available along with the changelog at [Haxe 4.0.0-preview.4 - Haxe - The Cross-platform Toolkit](https://haxe.org/download/version/4.0.0-preview.4/).

As a preview release, it should not be considered stable. However, we appreciate anyone testing this version which will help us with the real Haxe 4 release. Please report any issues here:

[Issues · HaxeFoundation/haxe · GitHub](https://github.com/HaxeFoundation/haxe/issues).

Thank you very much for your help!

The following is a list of major additions and changes.

**Improved compiler display services**  
Our focus for this release has been compiler display services. We implemented a new, JSON-RPC-based protocol which is utilized by the vshaxe Visual Studio Code Extension to provide a variety of new features:

- Support for auto-import
- Completion on `override |`
- Completion for structure field names
- Support for auto-generating structure declarations, functions, switches and more
- Context-aware, sorted toplevel completion
- Reference finding which explores modules that are not necessarily part of the compilation

**Improved enum abstracts**  
Enum abstracts now get the treatment they deserve with a proper `enum abstract` syntax. Furthermore, values can now be omitted if the enum abstract is defined over Int or String:

```haxe

enum abstract MyEnum(String) {
    var MyValue; // implicit = "MyValue"
}

enum abstract MyOtherEnum(Int) {
    var MyValue0; // implicit = 0
    var MyValue1; // implicit = 1
    var MyValue5 = 5;
    var MyValue6; // implicit = 6
}

```

**Various syntactic improvements**

- `extern` is now recognized as a field-level modifier and can be used instead of `@:extern`
- Metadata names can now use dots, e.g. `@:haxe.json` becomes a metadata entry named “haxe.json”
- Structure fields now consistently allow `var ?x` and `final ?x`, meaning the same as `@:optional var x`
- `Type1 & Type2` is now a recognized syntax for intersection types. For the time being, it is only supported to merge structures (replacing the `{ >Type1, >Type2, }` syntax) and for type parameter constraints (replacing `T:(Type1, Type2)` which has been removed from the language).

**Lots of bugfixes**  
[See the changelog for more!](https://haxe.org/download/version/4.0.0-preview.4/)

* * *

**… But wait there is more!**

We did several improvements on the [haxelib website](https://lib.haxe.org) too.  
There is a [new updates page](http://lib.haxe.org/recent) which has nice detailed overview of what is new on haxelib.

 ![updates](https://community.haxe.org/uploads/default/original/1X/07e8fcde4437440dbfe06932cddd6719435d94ca.JPG)

The project page of haxelib is also updated, the overview now has stats graph. It is displayed when you have more than one release.

 ![project-page](https://community.haxe.org/uploads/default/original/1X/3abdb242abd3f32d2bc1c3a6903be429e7eb8431.JPG)

And we dropped the tag cloud in favor for a more elegant [tag overview](https://lib.haxe.org/t/)

 ![tags](https://community.haxe.org/uploads/default/original/1X/df99d193efb79873688bd6758873004a260d7bab.JPG)

---

<div class="post-metadata">

### Author: ![mark.knol](https://community.haxe.org/user_avatar/community.haxe.org/mark.knol/32/50_2.png) [@mark.knol](https://community.haxe.org/u/mark.knol)
#### Post date: [June 12, 2018, 5:31pm UTC](https://community.haxe.org/t/haxe-4-0-0-preview-4-is-released/769/4 "2018-06-12T17:31:54Z")

</div>

Congrats on this release, super hyped now!

Question, if your abstract enum doest have a number, will it auto enumerate like this (??)

```haxe
enum abstract MyOtherEnum(Int) {
    var MyValueA; // implicit = 0
    var MyValueB; // implicit = 1
    var MyValueC = 5;
    var MyValueD; // implicit = 2
}

```

---

<div class="post-metadata">

### Author: ![dmitryhryppa](https://community.haxe.org/user_avatar/community.haxe.org/dmitryhryppa/32/1815_2.png) [@dmitryhryppa](https://community.haxe.org/u/dmitryhryppa)
#### Post date: [June 12, 2018, 5:35pm UTC](https://community.haxe.org/t/haxe-4-0-0-preview-4-is-released/769/5 "2018-06-12T17:35:51Z")

</div>

Hello, I’ve just tested it:

```haxe
package;
class MyApp {
    public static function main() {
        trace(MyOtherEnum.MyValueA);
        trace(MyOtherEnum.MyValueB);
        trace(MyOtherEnum.MyValueC);
    }
}

enum abstract MyOtherEnum(Int) {
    var MyValueA; // implicit = 0
    var MyValueB = 5;
    var MyValueC; // implicit = 2
}

```

And here’s what I’ve got:

```haxe
(function () { "use strict";
var $hxEnums = {};
var MyApp = function() { };
MyApp.main = function() {
	console.log("src/MyApp.hx:5:",0);
	console.log("src/MyApp.hx:6:",5);
	console.log("src/MyApp.hx:7:",6);
};
MyApp.main();
})();

```

---

<div class="post-metadata">

### Author: ![andyli](https://community.haxe.org/user_avatar/community.haxe.org/andyli/32/26_2.png) [@andyli](https://community.haxe.org/u/andyli)
#### Post date: [June 12, 2018, 7:11pm UTC](https://community.haxe.org/t/haxe-4-0-0-preview-4-is-released/769/6 "2018-06-12T19:11:11Z")

</div>

It uses [C’s enum](http://en.cppreference.com/w/c/language/enum) numbering. Basically, the value is the previous one’s + 1, unless it is the first one (0), or explicitly assigned.

```haxe
enum abstract MyOtherEnum(Int) {
    var MyValueA; // implicit = 0
    var MyValueB; // implicit = 1
    var MyValueC = 5;
    var MyValueD; // implicit = 6
}

```

---

<div class="post-metadata">

### Author: ![mark.knol](https://community.haxe.org/user_avatar/community.haxe.org/mark.knol/32/50_2.png) [@mark.knol](https://community.haxe.org/u/mark.knol)
#### Post date: [June 12, 2018, 7:46pm UTC](https://community.haxe.org/t/haxe-4-0-0-preview-4-is-released/769/7 "2018-06-12T19:46:40Z")

</div>

Check out this nice video about this release!

[![](https://community.haxe.org/uploads/default/original/2X/a/aa591ee4357d4df4bd77b4fb64978e1743d0e841.jpeg "Haxe 4.0.0p4 Released -- Much Nicer VSCode Support!") ](https://www.youtube.com/watch?v=SrS083Lx_YY)
