Monday, March 24, 2014

You there! Step away from yacc and nobody gets hurt.

LabKitty mad scientist logo
Once upon a time there was the perfect programming language. It was called C and it was good. Simple. Elegant. Easy to spell.

X3.159-1989 was a masterpiece, no less than the Aeneid or the Magna Carta. With it, ANSI created paradise on Earth, the capstone of a journey of 1024 steps that Charles Babbage had begun two centuries prior, his dreams of building a thinking machine out of wooden dowels and Ada Lovelace interrupted by love and death.

Then came the expulsion.

S---------- tempted us with the fruit of C++.



A Frankensteinian creation, C++ was. The one true language infected with OOPox. Nerdz, easily mesmerized by novelty, were defenseless against this poisoned gift of the North-men. Thus did a new Viking terror darken the world, as if the plundering Cnut himself had been reborn. The programming section of bookstores and libraries swelled to mammoth proportions. CEOs everywhere added phrases like "overloaded operator" and "multiple inheritance" to the list of things they pretended to understand. Copies of K&R collected dust on shelves , dismissed by the next generation of nerdlings as counter-revolutionary. Cursed by this cursed curse, Reason fled, writing ICHABOD on a whiteboard in the break room after cleaning out her cubicle.

Yet, in this hour of gloom, resistance was brewing in the most unlikely of places.

No one knows exactly when S----------'s foul spawn slithered out of his halon-fogged dungeon and into places where the grown-ups maintain multimillion-line legacy code that does actual useful things like finite element analysis and 5-axis NC. Legend has it the Dark Lord commanded his objects to seek out third-party packages to infect, reasoning that once the APIs were in C++ all other software would have to convert or die. So it began. Eigenvalue packages. Image processing libraries. Solid modelers. If you worked in a software shop during the heady 1990s, nary a day went by without some fieldbot waving a glossy pamphlet it had picked up at the latest tech-expo/coke-jag loudly demanding why your shop wasn't doing this omelette-oriented stuff. You patiently explained that your product was 5 lines of assembler, 50 lines of C and 500,000 lines of FORTRAN, and you can't call C++ from FORTRAN and get it to link without setting the building on fire.

Ah, FORTRAN. The charm of FORTRAN is that it Just. Doesn't. Care. You think people who bang on F77 care about overloaded operators and multiple inheritance? F77 doesn't even have pointers. FORTRAN is what Gypsy is programmed in. The Amish could use FORTRAN and technically remain Amish. What a mighty FORTRAN is our Lord! we would loudly sing, earnestly albeit off-key and mocked by the CS majors as they scurried off to draw fractals on their Sparcstations.<

So it was the grown-ups missed the whole C++ fad. Like St. Jerome laboring in seclusion to translate the vulgate while dance fever swept the land, we emerged blinking into the bright lights of the new millennium wondering what all the hoopla was about.

But the Dark Lord was not yet finished with us.

Out in Cupertino, Apple had come to its senses and was embracing Unix. Death to Pascal! (Yay!) Not only that, but Jobs promised the new OS would bundle with a suite of free development tools so you could make your own apps. Make your own apps! We shall retire at 25, like [ REDACTED ] would have done if he had any decency. Slide in the CD. Check the check box for the optional development tools. Install. At last! Double click XCode and we find... Obj-C. The hell!? This isn't Unix; this isn't even Aegis. Crikey, they may as well written the new OS in SNOBOL.

It was then we realized: He had had her. The creature. The bony fingers of the Dark Lord had reached out from his snow-covered fortress far above the Arctic circle where they ride she-bears to the shores of Palo Alto where girls on rollerblades sell tofu dogs on the boardwalk, their comely locks tousled by warm trade winds.

Crestfallen, we sought comfort in our beloved CodeWarrior. Scrolling wistfully through the menus. Remembering the good times. Our first off-screen GWorld. Our first ctSeed slam. Emulating TCP/IP using AppleTalk. A chill came over us, as surely as it did Nelson walking the decks before Trafalgar. Soon to be gone, we now understood. Like the dinosaurs. Like ThinkC. The old machines would wink out one-by-one.

We could almost hear S----------'s maniacal laughter off in the distance, high atop Denmark, leaning over the bluffs to survey the cowed lands below, encircled by bats and goshawks and other flapping creatures rising on the warm thermals of evil.

But then -- a flash of insight: this abhorrent majik could be undone!

Obj-C contains within it C, no? And within C, a preprocessor as mighty as Agamemnon . We shall preprocess the evil out, like sucking forth the venom from fresh snakebite!

Ferociously we labored to #define away every square bracket, every syntactically-bizarre syntax, every gramatically-backward keyword. We reverted message passing back into function calls, garbage collection back into malloc, and every instance of "autorelease" to "autoretain" because, c'mon, that's what it really means if you bothered to RTFM. Our corrective header file was epic. Still, Obj-C would not relent. Like a hydra, every foul feature we preprocessed away spawned three new heads demanding remedy.

And then something strange happened (well, stranger).

As oft occurs while you are ravaging the enemy's country, burning the villages, salting the fields, violating the women and livestock, the local customs transformed the invaders. Captive Greece took her captor captive.  The ways of Obj-C gradually began to seem less strange, less convoluted [ insert breezy montage here of scrappy Obj-C leaving a plate of brownies on LabKitty's stoop. Obj-C nosing a meatball onto LabKitty's plate. Usw. ]

Eventually, our preprocessor project was abandoned. Obj-C's plucky charm was, well, if not embraced, at least it no longer filled us with murderous thoughts (although you guys REALLY need to change "autorelease" to "autoretain"). From now on, our murderous thoughts would be directed at more deserving targets, like the Zazzle search engine .

Meanwhile, many miles away, there's a shadow on the door, of a cabin on the shore, of a dark Scottish lake...

No comments:

Post a Comment