Saturday, March 08, 2008

ErlyDTL now has date and time formating

ErlyDTL, the Erlang version of the Django Template Language is progressing nicely. Most of the common tags and filters are implemented. Recently Colm Dougan joined the development team and added date and time formating.

Let's take a look at some examples with fictive dates:

Template: {% var1|date "r" %}
Rendered Output: Thu, 21 Dec 2000 16:01:07 +0200

Template: {% var2|date "jS F Y H:i" %}
Rendered Output: 27th February 2008 01:24

Template: It is the {% var3|date "jS o\f F Y" %}
Rendered Output: It is the 4th of September 2007

Friday, March 07, 2008

Diving into Core Erlang

Inspired by Robert Virding's LFE - Lisp flavored Erlang, I recently started to evaluate Core Erlang as base for ErlyJS, the Erlang Javascript compiler I am working on. The current approach is based on Erlang Abstract Syntax trees. Erlang Core is more low level and looks more like a LISP dialect than Erlang. Following a short summary about Core Erlang's design goals (copy pasted from the spec):
  • Core Erlang should be as regular as possible, to facilitate the development of code-walking tools.
  • Core Erlang should have a clear and simple semantics.
  • Core Erlang should be straight-forward to translate to every intermediate code used in any Erlang implementation; similarly, it should be straightforward to translate from Erlang programs to equivalent Core Erlang programs.
  • There should exist a well defined textual representation of Core Erlang, with a simple and preferably unambiguous grammar, making it easy to construct tools for printing and reading programs. This representation should be possible to use for communication between tools using different internal representations of Core Erlang.
  • The textual representation should be easy for humans to read and edit, in case the developer wants to check what the Erlang source looks like in Core Erlang form, inspect – or modify – the results of code transformations, or maybe write some Core Erlang code by hand.
You wanna see how Core Erlang looks like ? Take any Erlang source code and compile it as binary and with the to_core compiling option and with core_pp:format/1 you can pretty-print the output. Core Erlang is an intermediate step between Erlang AST representation and VM internal representation. So far I see the following advantages by using Core Erlang for ErlyJS:
  • It is less tied to Erlang the language and therefore just a more natural choice.
  • There exist `let` expressions which seem to provide a cleaner way to handle Javascript variable reassignments (you can't directly reassign variables in Erlang).
  • And last and least, Ecmascript 4 Reference implementation is written in Standard ML, which is more similar to Core Erlang than to normal Erlang. Maybe this point will have relevance one day in the future.
Unless I will discover a show stopper, there will be soon a complete rewrite of ErlyJS to Erlang Core (but I am using git now and only pushing to googlecode SVN major changes in bulk).

Thursday, March 06, 2008

Erlang and Fuse

The Dukes of Erl guys have created an Erlang implementation of FUSE called fuserl. From reading their blog, it seems they need it for interacting with RRDtool, a open source software for realtime data logging and the ultimate goal for fuserl is a distributed filesystem based on mnesia: walkenfs (the idea is not new, Ulf Wiger has something similar as part of erlhive). Now I just read about another possible use case for fuserl:

The advanced strategies of internet marketing are employed by the different internet marketers to promote E-businesses. The web site design and web development programs are organized by the different IT companies. The cheapest domain name registration services are very useful for the medium kind of entrepreneurs who can’t afford expensive rates. The cheap hosting services of various web hosts are available to facilitate the individuals who run small businesses.