What I liked most about Erlang as a functional language

Erlang comes with all the built-in concurrency and distributed programming support which will blow you away if you are familiar with distributed systems. However, I will save that talk for some other day. If you see erlang as a pure functional language, it is really powerful! And among all functional languages I’v played with (javascript, php, ruby), one thing I looooooved about erlang is that it is a compiled language! Coming from java background, I become really pissed when program fails for silly syntax error!

I have this feeling that the future languages will become more and more like erlang. With all the multi-core processors, thats the way to go! Only thing I don’t like about it is that the syntax is more like mathematics and less like a language. Again, coming from java background, I might have become too comfortable with more descriptive language. Time to get out of the comfort zone!

How to setup Emacs as Erlang IDE on Windows XP

There are a dozens of links in the web for setting up erlang as an emacs IDE with syntax highlighting, indentation, compilation , debugging support. However, none of them is as straight forward as this one HERE. However, this was written for linux boxes. You can replace the linux relative paths with your windows relative paths. Just keep the following points in mind.

  • Erlang default installation path “C:\Program Files\erl5.6.3” is not supported by Distel (because of the whitespace in ‘Program Files’). You can either install erlang in a different location (C:\erl5.6.3), or use shortcut path location : “C:/progra~1/erl5.6.3”
  • You don’t have to checkout the distel code with svn if you don’t have svn client. You can download it directly from HERE.

Just in case, I am pasting my .emacs file here

;; This is needed for Erlang mode setup
(setq erlang-root-dir "c:/progra~1/")
(setq load-path (cons "C:/progra~1/erl5.6.3/lib/tools-2.6.1/emacs" load-path))
(setq exec-path (cons "c:/progra~1/erl5.6.3/bin" exec-path))
(require 'erlang-start)

;; This is needed for Distel setup
(let ((distel-dir "C:/dev/erlang/distel/elisp"))
  (unless (member distel-dir load-path)
    ;; Add distel-dir to the end of load-path
    (setq load-path (append load-path (list distel-dir)))))

(require 'distel)
(distel-setup)

;; Some Erlang customizations
(add-hook 'erlang-mode-hook
	  (lambda ()
	    ;; when starting an Erlang shell in Emacs, default in the node name
	    (setq inferior-erlang-machine-options '("-sname" "emacs"))
	    ;; add Erlang functions to an imenu menu
	    (imenu-add-to-menubar "imenu")))

;; A number of the erlang-extended-mode key bindings are useful in the shell too
(defconst distel-shell-keys
  '(("\C-\M-i"   erl-complete)
    ("\M-?"      erl-complete)
    ("\M-."      erl-find-source-under-point)
    ("\M-,"      erl-find-source-unwind)
    ("\M-*"      erl-find-source-unwind)
    )
  "Additional keys to bind when in Erlang shell.")

(add-hook 'erlang-shell-mode-hook
	  (lambda ()
	    ;; add some Distel bindings to the Erlang shell
	    (dolist (spec distel-shell-keys)
	      (define-key erlang-shell-mode-map (car spec) (cadr spec)))))

Sun’s Garbage First Collector : do I have to buy it!

Those of you who are involved in real time application development surely have suffered from the unexpected GC pause time. I have spent quite a bit of time trying to tune my Heap generation spaces, playing with new generation / old generation size , GC algorithms etc. I had my eye on the Sun’s Garbage First Collector. Basically it is the replacement of the old CMS (Concurrent mark sweep) collectors and can be extremely useful for large heap low latency applications. I just read this article which suggests sun is going to make this commercial !!! I wonder whether the Oracle acquisition is revealing its true nature! One of the main reason why Java is still my favorite platform (I am falling in love slowly with dynamic languages like Ruby, Erlang, PHP..man! you can do magic with them !l!) is because of its solid and open VM. If sun moves away from its open policies, I wonder if Java will become the legacy language in near future????!!!.