Summary
Flapjax is a new functional language that runs in a web browser's JavaScript interpreter, effectively wrapping JavaScript and extending it with functionality useful for Ajax applications. Cameron Laird's recent IBM developerWorks article introduces Flapjax, and provides examples of its use.
Advertisement
Several approaches to mask JavaScript's darker corners have emerged in the past few years: the Google Toolkit (GWT) allows you to compile Java code to JavaScript; Ajax toolkits, such as Prototype, Dojo, and script.aculo.us attempt to provide high-level components on top of JavaScript; and Flex lets you fast-forward to the strongly typed world of EcmaScript 4, the future-generation JavaScript.
It is also possible to take another tack and build a new, possibly nicer, language on top of JavaScript itself. If that new language can be evaluated by JavaScript, programs written in that language would run anywhere JavaScript runs. That latter path was taken by the Flapjax language project:
Because Flapjax is built entirely atop JavaScript, it runs on traditional Web browsers without the need for plug-ins or other downloads. In fact, you can (in exchange for a little more code) use Flapjax purely as a library in JavaScript rather than use the compiler from Flapjax to JavaScript, so you can integrate it into your existing programs.
A recent IBM developerWorks article by Cameron Laird, Flip for Flapjax introduces Flapjax, pointing out that:
[Flapjax] happens to have the same syntax as JavaScript, and the first implementations are tied to JavaScript in several other ways ... but its creators are affiliated with academic interest in programming language theory. They categorize Flapjax as a "functional reactive" language, one that supports functional programming in combination with declarative and imperatives forms...
Flapjax mainly defines and helps you express "reactions"—correspondence between such inputs as end-user movements and selections, and outputs such as the view in the browser window...
Along with improvements in traditional Ajax expressions, Flapjax implements a few capabilities that are not traditional for Ajax coding. One of these, crucial in collaborative applications, is server-side persistence. Flapjax makes it easy to store and retrieve information from a browser ... back to the server. From there, data is available to any client. This allows a team, for example, to work together on a document—its text is just a persistent Flapjax variable...
At the same time, Flapjax is compatible with existing JavaScript... It rests on the Dynamic HTML (DHTML) and Cascading Style Sheets (CSS) that JavaScript already uses, and does not currently add any new visible elements. In this perspective, Flapjax is purely algorithmic and contributes nothing "visual"-- it only makes programming the widgets you already know easier.
What do you think of Flapjax's viability as a language for Ajax application development?
> Why it is considered a language and not a library?
I think it's a language that you then compile into JavaScript. They provide a server-side compiler in Python. But its facilities can, apparently, be used as a library as well.
This is actually a really good idea, but it doesn't address what JS script writers are asking for (which is why the comments section here has probably gone ignored).
Still, the pain points of JavaScript mostly have to do with the ghosting / sluggish UI update issues you get, like from trying to update a table of data while executing a freeze pane (like freeze panes in Excel). The "Desktop WebOS" is a pipedream until you can do tasks like this.