My professor runs a website on the USA elections. I help him some with the graphics.
Since the site features a lot of dynamic graphs, I build a numbers-to-graphs system by combining Bourne Shell and Ghostscript. This gave me a very powerful code and data pre-processor on a very powerful graphic language.
It took many hours to write the program. Luckily, the result was surprisingly dynamic; Because every thing parameterized, things often stayed visually pleasing even with input parameters we had not anticipated. For example midterm elections (right top image) have only house and senate races, but no electoral votes prediction like the presidential elections (left top image). Originally the program could handle only presidential elections, but with two numbers changed an one line removed, it generated the midterm graphics adequately. Take a look at some of the other graphs at electoral-vote.com. Just click on the map.
Newer languages like Java lack a preprocessor like C has. The #ifdef AAP is replaced by if(aap) with aap declared final. However, cpphas more to offer than conditional code. A preprocessor is a domain specific language for symbol manipulation that can also offer meta programming and language alterations. The __LINE__ directive is an example of the former. Below an example of the latter:
To fully use a preprocessor, a coder needs to be uber-flexible. Only a few are. Hence the frustration with languages like M4 or the expansion delay effect of && in the SAS macro language. Some preprocessors were added out of necessity. Just imagine writing 10 KLOC of assembler without using a preprocessor. To quote Al Bundy, I’d rather bait a crocodile with my manhood.
A while back, I designed a domain specific language. It combines the good of APL, C, Pascal and SQL. For example, the token ‘=‘ is not used, ‘:=‘ is the assign-token and ‘==‘ is the equal-token. Like C, it uses only ASCII characters and, like APL, it has a minimalistic, mathematical notation. There is no muli- or list-assign, like in Python and Perl, eventhough code like this: ‘(a,b,c):=(b,c,3);‘ just looks so cool and intuitive. But, it did not fit the syntax, it would make it hard to parse (both for humans and for the LR parser) and most of all it went against the minimalisticity. Than I came up with ‘=:‘, the post-assignment operator. It took me but five minutes to implement. It is a regular assignment but returns the old lvalue. For example ‘a=:3;‘ would assign ‘3‘ to ‘a‘ and return what ever value was in ‘a‘ before. Post-assignment; analogous to the post-increment from C. IMHO, It makes the above shift even more elegant to read: ‘a=:b=:c=:3;‘. It was love at first sight! However, the smartest person I know (and first programmer in this language) did not see the need for this opperator and neither did anyone else. So I swallowed my pride and removed the ten odd LOCs. I cried myself to sleep that night.
“HipHop for PHP isn’t technically a compiler itself. Rather it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP’s runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.“ (Haiping Zhao) [HipHop for PHP: Move Fast]
Given the totally adhock way PHP is structured combined with the fact that Zhao claims his compiler is not a compiler but a “source code transformer” makes me wonder what exactly is going on. These steps the transformer takes to do it’s transforming look suspiciously like compiler steps:
Whenever I heard people redefine the term “compiler” it usually turned out they were hand coding a recursive decent parser. I know, it’s easy to bash something you have no experience with, but if someone is talking about “reimplementation of PHP’s runtime system” any professional-coder should raise an eyebrow. Besides, would you want to clone all that PHP magic stuff into a new runtime system? Next to a PHP compiler, Zaho is also writing a PHP interpreter: “We have also developed HPHPi, which is an experimental interpreter designed for development. When using HPHPi you don’t need to compile your PHP source code before running it. It’s helped us catch bugs in HipHop itself and provides engineers a way to use HipHop without changing how they write PHP.“ My guess is that facebook would have been better off with a formal language that is PHP like but much simpler and mostly orthogonal. On the other hand, being well designed is no prerequisite for being popular.
“Sikuli is a research project developed by User Interface Design Group at the MIT [...] Sikuli Script automates anything you see on the screen without internal API’s support. You can programmatically control a web page, a desktop application running on Windows/Linux/Mac OS X, or even an iphone application running in an emulator.“ [Project SIKULI homepage]
From the paper, it shows that Sikuli Script is motivated by the desire to address the limitations of current automation scripting languages like: AppleScript, Windows Scripting, DocWizards, Chickenfoot, CoScripter, and macro recorders like Jitbit9 and QuicKeys. On Slashdot it is promoted as quite a bit more. See [MIT Offers Picture-Centric Programming To the Masses With Sikuli]. Personally, I think, picture-centric programming for the masses will have to wait, but Sikuli is perfect for writing test programs for GUI applications. Thank you MIT for a scripting language that is reasonable indifferent to GUI element alignment changes.
With countless new languages hitting the scene, it is refreshing to find one that clearly states its domain (systems programming) and a realistic set of goals. Leave it to Google to roundup some smart and experienced people, to create this new language, they dubbed Go (mainly because “Ogle” would be a good name for a Go debugger).
“Go was born out of frustration with existing languages [...] One had to choose either efficient compilation, efficient execution, or ease of programming; all three were not available in the same mainstream language. Programmers who could were choosing ease over safety and efficiency by moving to dynamically typed languages such as Python [...] Go is an attempt to combine the ease of programming [...] and safety [...] with support for networked and multicore computing [...] it is intended to be fast” [Language Design FAQ]
Are you a lead developer? Do you feel commercially trapped? Would you like your own company for your brainchild? Are you too risk averse to start it? Change the rules! Start by visiting 4F Invest. You'll find it interesting.