Citrine borrows from Ruby, JavaScript, C for object-oriented programming

Combining ideas from Ruby, Smalltalk, JavaScript, and C, the Citrine language intended aims to simplify object-oriented programming.

Positioned as an easy-to-learn general-purpose programming language, it's planned for use with Unix-like OSes, including Linux, OpenBSD, and Mac OS X.

"With Citrine, I hope to bring the beauty of Smalltalk to wider audience, while adding some nice features from other languages as well: prototypes from Self (and JavaScript), pipelines from Unix, curly braces from C, and template syntax from PHP," said developer Gabor de Mooij in an email. "I just took the ingredients I liked most from the programming languages I work with and combined them."

Everything is an object in open source Citrine, de Mooij said. "You write a program by making these objects talk to each other, by sending messages. What is the benefit of everything being an object It makes object-oriented programming easier." In Citrine, an email address, for instance, would be an object. "The trick here is that you can implement very beautiful object oriented architectures without having the feeling you're constantly over-engineering," said de Mooij.

The language emphasizes readability to better enable others to subsequently extend and modify the code. It uses "syntactical and conceptual minimalism" for the sake of simplicity, the Citrine website notes. A block of code can be treated like a function; dynamic scoping is featured as well, along with closures and higher order functions.

For reusing code, Citrine leverages prototypical inheritance. "Suppose you have a dog and a cat, both can respond to the message 'eat', so to avoid duplicate code we put that response in another object called Animal and then create dog by sending the message new to Animal instead of Object," the Citrine website explains.

De Mooij describes Citrine as a "still a young language." He expects to reach either an 0.9 or 1.0 release milestone by the end of the year. Citrine is available via a BSD license.


Paul Krill

Zur Startseite