Tricky unsafe cast is too tricky

Important: this article is written about Haxe 3.1.3. It works well in Haxe 3.2 🙂

Few days ago I wrote about eight things I don’t like in Haxe, and one of thing was tricky unsafe cast syntax:

(cast findViewById(R.id.myTextView):TextView).setText("Cool");

compared to safe cast:

cast(findViewById(R.id.myTextView), TextView).setText("Cool");

However I was wrong. This unsafe cast work fine only on dynamic targets, but on cpp it cause compilation error:

Continue reading

8 things I don’t like in Haxe

STOP right here. Before I say a few words of criticism about Haxe, you should know, that i REALLY like this language.

Btw, this post is pretty old, haxe was improved since I wrote it.
Feel free to read other posts 🙂
Top 3 (in my taste):

Ok, let’s continue.

I use many programming languages everyday, and Ruby Haxe is the most promising of them. Thanks to Haxe I can build my projects for web, for mobiles, build them as native applications. Comparing with JavaScript, Haxe has strict typing; comparing with C++, Haxe is MUCH easier to write. Enum-matching is fantastic thing! And last, but not least, Haxe allow me to write platform-specific code via untyped keyword (just like old good #ifdef in C / C++).

But there are several things that make programming in Haxe more complex and not so exciting. Maybe some of that things will be fixed in next versions of Haxe, while other things is by design and will not be fixed even in Haxe 4 / Haxe 5. Anyway, I still want to talk about them.

Continue reading

Setter with default getter + Actuate = problem

Let’s say you need to animate some custom property of object. And you choose to use Actuate as tweening library:

Actuate.tween(someObject, 1.0, { myOffsetX: 100 });

Moreover, you need to do some work when property updated, so you decide to create a setter:

public var myOffsetX(default, set):Int;

private function set_myOffsetX(value:Int):Int {
    if (value != myOffsetX) {
        myOffsetX = value;
        doSomeWork();
    }

    return value;
}

It works fine while you building it to flash, but stop working on html5 or native.

Continue reading

Snow / Luxe + Android NDK-r10c

2015-02-01

First time, when I heard of snowkit, I fall in love to snow. It is nice, easy and low-level haxe library to develop games and applications. While some important to me features are missing (async network requests, for example), it is still worth to try.

I playing a bit with web builds and native builds, but every time I tried to build any app (including examples) for android, I get something like

... undefined reference to __srget ...

Continue reading