Archives for June 2007

Programming languages and platforms: Existential doubts

Through my whole career I was torn between what I like (Prolog and Caml) and what makes me marketable (Java, VB, Perl, C, Python, C#). Of course, the world is not black and white so, in the list of marketable languages there are some that more likeable to me than others.

Java is acceptable, but is too verbose and the libraries are grossly over engineered (with no apparent advantage), of course a DSL framework is nowhere to be seen. Python is also acceptable, but the lack of DSLs (and Guido explicitly stating that he is not going in that direction in Python 3000) makes it loose a lot of its sex appeal, also, less importantly, I have some bias towards strong typing.

Enter Ruby: DSLish, very pragmatic, a vibrant community, a fantastic JVM implementation, and one can $$$ on it… I am giving it a try.

Regarding platforms, a less important issue for me, I am quite happy working on top of the JVM: multi platform, stable, industry support, really open…

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • connotea
  • DZone
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

Filed in: Java, Python, Ruby, declarative programming

by: tiago

1 Comment

Caml love: typing

One of the many interesting features in Caml is strong typing that might be explicit or implicit, i.e., type declaration is optional (it is always inferred).

One (dumb) example, list reversal, which already exists in the core libs (and we will use it):

let invert lst =
  List.rev lst
;;

Which Caml infers it is of type

val invert : 'a list -> 'a list = <fun>

(i.e., a function which takes a list and returns a list of the same type).

Let us now imagine that we want our own invert to support only lists of integers, we do:

let invert (lst : int list) =
  List.rev lst
;;

Caml infers:

val invert : int list -> int list = <fun>

One can be “lazy” when coding (i.e., not explicitly declaring types) a la scripting languages, but when going through the debugging hell that sometimes can happen with weak typing (in the Caml case it is really inference of a more general type than the correct one, or because of a wrong call, a wrong inference), explicitly type and force the offending code to show up.

Of course, one should try to be consistent and maintain the same style over all code, but I sometimes find my code to use both implicit and explicit conventions. This is due to laziness coupled to the fact that probably nobody will read me Caml code :( .

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • connotea
  • DZone
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

Filed in: declarative programming

by: tiago

No Comments