simple100586437orig

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

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

Positioned as an easy-to-learn general-purpose programming language, Citrine can be used 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 overengineering," 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.

IDG Insider

PREVIOUS ARTICLE

« You can play Star Citizen for free this week

NEXT ARTICLE

See Chrome's Material Design facelift before its official rollout »
author_image
IDG News Service

The IDG News Service is the world's leading daily source of global IT news, commentary and editorial resources. The News Service distributes content to IDG's more than 300 IT publications in more than 60 countries.

  • Mail

Poll

Do you think your smartphone is making you a workaholic?