Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

So I was talking to a friend and he mentioned

Using WAC I can write Javascript code that will compile and run in iOS, Android, BB etc

and there is this programming language that lets you write code that is multi-platform:

http://haxe.org/doc/intro

I was wondering why these hasn't got that much attention yet because the idea is so good.

So in a sense, what is probably wrong with these ideas in a real-world perspective(real deployable projects)?

EDIT: So I have probably misused some terms so here are some clarifications. It goes something like, for example, I write code in one language, then I can run it in iOS and Android devices, both of which have their native programming languages. That means I have an app that I can run on both device without having to code any Java or Objective C That's the best I can do for clarifications because I myself am a little confused T_T

share|improve this question

closed as primarily opinion-based by gnat, MichaelT, GlenH7, Bart van Ingen Schenau, Yannis Rizos Dec 15 '13 at 20:09

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
I dont know a lot of languages that are not multi-platform. Java only runs in the JVM, but is considered multi-platform. Ada, C, C++, C#, Fortran, and most other popular languages actually are available for all major platforms. –  oenone Sep 9 '11 at 8:19
9  
They are popular multi platform languages: Java, Python, Ruby... to a degree, one could even count c. i think, you mean something more with 'multi platform language' than just 'code once, run everywhere'. could you please clarify? –  keppla Sep 9 '11 at 8:19
    
Despite the title and the link, I think the OP refers to software able to compile code for various platforms at the same time, given the same code. Think RealBasic for example. –  Jose Faeti Sep 9 '11 at 8:23
    
the edit has been applied to clarify the question which is pretty much what Jose Faeti said –  Ygam Sep 9 '11 at 8:44
    
C and C++ was also meant to do this, you can compile them for different platforms. But languages like Java and JavaScript does this to a bigger extent where you don't have to complile the language for different platforms, just run it in a virtual machine that is done for different platforms. –  Jonas Sep 9 '11 at 10:18

7 Answers 7

The point may be this sentence from the site you linked to:

platform-specific libraries : the full APIs for a given platform are accessible from haXe

Which means, once you write a haXe program targetted for .Net, for example, it's equally different to port it to the JVM, say, as if you wrote it in C# right away.

Because the value in those platforms are not so much a particular language like C# or Java, but the (more or less) well founded APIs.

To avoid this, one had to have a über-API that maps to the choosen target API on demand. Not impossible, nor uninteresting, but much, much work to get it right. (Usually, you'll find that just the corner of the API you want to use is not yet implemented or portable.)

Projects with difficulties like this: GNU java compiler (weak API coverage), wx (platform independent graphical API, it has gained some popularity, but it's never near completion AFAIK.)

share|improve this answer

I suppose, when you mean crossplatform, you speak of things like this (press space for something to happen):

Using jeash, the code for the first and second demo is virtually identical, only the second demo must be compiled with --remap flash:jeash, to remap the native flash player API onto the jeash abstraction layer.

The same is also possible using nme to use the flash player API on various other devices. Therefore you can just as well target iOS and Android with the same code, as seen here: iPhone left, android right
More on that on nabble.

To sum up haXe's problem:

  • haXe is still growing and maturing. And its growth is always ahead of its maturity. You have a fair amount of features subject to change. A lot of really funky cool stuff, that just ain't documented. And so on.
  • haXe hasn't reached critical mass yet. Even though there is a community big enough to get all the support you need, it is very far away from becoming a main stream language.

It's young and small. It's also what makes it fun. Personally, I love haXe, even though I can think of a hell lot of things I would change about it, if I could. But it's exciting and challenging.
The thing is, most people in our industry don't want excitement or challenge. I am quite often denied to write a project in haXe, simply because its future is considered relatively unsure (a fear that is understandable, yet unneeded IMHO) and because it's hard to get a replacement for a haXe coder.

And at the bottom line, this applies for most technologies like that: They are small, they are young and therefore it's hard to get people for them, it's hard to tell where they are headed and whether they will prevail. Plus you have to keep up with their pace.
For bigger companies, this is basically a no-no.

share|improve this answer

Speed: a good programmer will be able to write faster code than what was translated from a higher-level language.

Language specific features: Some of the language specific features can't be used because you won't be able to compile them to multiple targets.

Need : As a programmer you pick the right tools for the job. There isn't any advantage in compiling to other languages that don't have all the features you want. For example if I wanted to write something that would work on Linux and Windows I would use Java. Being able to compile to C++ as well wouldn't help.

Hardware specifics: for hardware like phones to access most of the hardware or to use the full power of the phone you need to code in the language the phone understands. JavaScript + HTML don't always cut it.

I'm assuming from the body of the post you meant "multi-language" rather than "multi-platform" in the title. If you want "multi-platform" code there are lots of alternatives.

share|improve this answer

As a general rule, a code written for a specified platform will perform better and have less issues than one supposed to be multi-platform.

If you stick to one platform, you only need to debug your code for that platform, and you know the code you wrote. By using a cross-platform compiler, you don't know what kind of specific-platform code it will add, and if it will work as expected.

Even if you use a specified programming language or software able to make it compatible for different platforms, you still have to make sure the code don't break after the targeted platforms update, cause it may take time before a fix patch for the software you use will be released.

Also, the code you write for specified platforms will be optimized, and won't have additional useless code just for the sake of compatibility, so it will be easier to maintain, as long as you have the resources to differentiate the code for each platform (you might need different programmers for example).

It really depends on what are you needs.

In a web context for example, you really need to have cross-browser compatibility code, also counting existing mobile devices and the new ones coming out. You also always need backward compatibility (IE anyone?), so there's a lot of code you have to bring along the way in future releases.

Frameworks are a great help and are really effective, at the cost of a bigger code library, you can develop safely cross-browser compatible code.

share|improve this answer

There is always an adoption curve for new technologies / ideas / languages: first early adopters, then mainstream adopters, then late adopters. In the beginning, when the idea is new and unproven, it has little to no tooling / IDE / framework support and its implementation is (usually rightly) expected to be buggy. So only adventurous kinds play with it, and companies are very reluctant to base their business on these, however interesting they look. Eventually, if the idea is tested and proven, it gains momentum and followers, its bugs are shaken out, its features and tool support is improved, so it gradually it may become feasible as a production development platform. This process takes years though.

In summary, there may not be anything wrong with these ideas, just they may need time to spread.

Specifically the idea of compiling from one higher level language to another is nothing new - writing the first compiler for a new language as a C preprocessor is a known trick since the 70s. I fail to see what actual advantages this is supposed to offer over existing VM-based languages - but then again, I am totally new to the concept :-) I also have some doubts though how this can work out in practice with so many different platforms, each having its own limitations and idiosynchrasies. It may result in ugly little incompatibilities between compilations of the same code to different platforms... Only time will tell this.

share|improve this answer

First of all, most languages are multi-platform. For any usable platform, there is a C compiler. JVM and all languages based on it runs on plethora of platforms. There is also Python version for any currently used platform. And the list goes on, and on.

Of course in case of iOS, the limitation is not the platform itself, but Apple's policies not allowing to use above without jail-breaking.

There are cross-platform tools, like for example Unity, which go around this problem in a way similar to HaXe — by code generation.

So actually your question should be "Why isn't HaXe popular?". For such a question my guess would be, that it's just adding unnecessary extra layer of complexity, and extra exotic language to learn. It's at disadvantage with other cross-platform solutions, which instead of inventing whole new language, use well established one and translate/cross-compile that to native one for the platform.

share|improve this answer
    
Isn't Python or Java just such a layer? It is an extra exotic language, that adds the comfort of running the same code on different systems. They have the same approach, but higher popularity than haXe. Would you say, that's not a consequence of far bigger age (Python 1991, Java 1995, haXe 2005) and that Python is easily used for scripting, while Java was simply strongly marketed by a major company? –  back2dos Sep 9 '11 at 10:31
    
@back2dos: No, there is no analogy at all. Neither Python nor Java need to be translated to other high-level languages in order to be run. And yes, you're right, language developed by big company has advantage over single-person project. –  vartec Sep 9 '11 at 12:51
    
haXe doesn't have to be translated to other languages to run. You can directly output to the NekoVM or the AVM (which in fact were the first 2 targets). It has just proven very useful to output other languages as well, which enables haXe to run in any browser having JavaScript and on any server having PHP (both having quite a market share) on to compile to virtually any device (including iOS and android) via C++. Translating to JavaScript is also done for Python and Java, although attempts (Pyjamas and GWT) are just about as recent. I see a lot of anology in fact. –  back2dos Sep 9 '11 at 16:27

First of all, Language is a matter of choice. There are numerous developers with able qualities in various language but they stick to one with a core programming language TAG. Next thing is that these languages are still pretty new, people haven't yet adapted to them. This will take some time, like the other languages did.

Other issue can be performance and adaptability. IMO, Languages written for particular framework are much more capable and able in specific framework. All in all, it's a time driven issue. If such languages evolve good over time and provide stable development environment, along with better community, we can expect things to change.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.