CallStream Part 3 : C++ Binding

Intro

paradigm-shift-2
A paradigm shift (or revolutionary science) is, according to Thomas Kuhn, in his influential book The Structure of Scientific Revolutions (1962), a change in the basic assumptions, or paradigms, within the ruling theory of science. It is in contrast to his idea of normal science.

CallStream Part 3 : C++ Binding

Good old C++ is one strongly typed language. CallStream concept is born (and bred) in the domain of type-less JavaScript. Also, C++ is (so called) static (compiled) language, vs dynamic (interpreted) JavaScript. C# is somewhere in between, (but not in the middle !) especially in it’s latest 4.0 reincarnation. Still I think CallStream should be implemented in C++ too. Why?

Because CallStream is not an implementation idiom of an programming language. It is a programming concept. And concept is not very good if it is not universally applicable. In which case it is not ubiquitous, and therefore not used everywhere by everyone. Not successful, in one word.

In case of C++, I have decided to make an (sort of a) type-less CallStream. An C++ interfacing mechanism which allows for more or less same call-streaming as in JavaScript. Where one can “call” anything with any arguments.

Above is the main(), of the real code that compiles and runs. (in VisualStudio 2008). This CallStream implementation allows calls where first argument can be a string literal, function, intrinsic type or object (aka class instance). With any number of any type of arguments following. Let’s jump straight to the CallStream code.

 

In this solution there is one CallStream class, serving the needs of all.