metamerist

Saturday, November 03, 2007

A class called "var"

The previous post bemoans "language flux," but the spark behind that post was a thought I've been pondering. The syntax of C++ and JavaScript are pretty close. This leaves me wondering how far one could go in creating code that functions as both valid C++ and valid JavaScript.

The biggest problem I see lies in disconnent with static vs dynamic typing, but here's the idea. If one created a C++ class named "var" that modeled the behavior of dynamic JavaScript variables as closely possible, I'll bet one could make quite a bit of hay out of it. Anything approaching first class functions seems daunting, but the prospect of a class named "var" seems promising even if it only handles strings, floats and integers.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home