Type Template Or Generic Type

Chinese poets started with regular forms but ended up with irregular forms. After all, our emotions are not uniformly paced. Irregular forms also came with standardized poetic scores, previously called poetic interfaces just to highlight their resemblance to type interfaces in object-oriented languages. The purpose of irregular forms was not to facilitate poetry writing but to maintain the principle of plug-and-play known as poetical engineering. Once a code contract is agreed upon, you can take any compatible melody and any compliant lyric for combinational performance, commercial or not. It’s highly flexible. Why was Chinese poetry developed to such advanced forms about 1300 years ago? Well, poetry was highly commercialized back then to fuel the paper industry. Where there is money, there is advanced development. Chinese were no different. But, why did they give up? No one knows. What we do know is that the focus shifted to novels later, which obviously contributed to volumes. There is no official historical Chinese communication to prove that the later development of Chinese literature had to do with paper economy. However, there are numerous historical records indicating the need for more space to express more and deeper ideas.

Okay, let’s not forget. The real reason to understand a bit of Chinese poetry is to know a bit of how syntax and semantic can play into each other linguistically or even computationally. Obviously, Chinese poets were not linguists or computer scientists. Some of them were mathematicians, but they were not aware of the link between formal languages and mathematical models. Somehow, they were playing with words and fitting them into code contracts that actually sold well to the public. Certain things just worked magically, but they didn’t know why. Taste is such a mysterious thing that sets good writing apart. I am not there yet. So, let me get back to the basics.

A type is a higher-order object, but a template is a higher-order type, though not the only kind of higher-order types as it takes the route of parameterization to describe families of types. A template is a higher-order type in the sense that a function is a higher-order value or object. It goes by arity. The difference is, of course, that a function comes with a code definition that a higher-order function is supposed to accept without argument evaluation so as not to fool itself by taking the return value of its argument instead. On the other hand, a type template and a higher-order function are in fact equivalent because a template comes with a default constructor that a higher-order template is supposed to accept without object or even type instantiation so as not to fool itself by taking an instance of its argument instead. Put simply, a generic type is just a run-time type template to avoid code bloat. In Java, there is no difference, because all objects are placed on the memory heap, except for a few standard primitive types, which are known at standardization-time. Time-wise, you can’t be more advanced than that!

Ideally, we want a Java machine that supports value types, which can be garbage-collected unlike their .Net counterparts. Unloading types by unloading entire application domains is such a stupid and horrible idea that kills all efficiency already achieved on the .Net platform. History has proven: more than 99% of human beings cannot code without garbage collection. The feature is here to stay with our Internet machine. How to do it right is the real question. Again, I can worry about this much later.

Forget object-oriented programming! I just changed my mind. I will take the functional persistent approach to the Internet machine, armed with effective dating!

Advertisements

About Run Song

Run Song (宋闰) is my pen name for the Moments of Poetry, a collection of poems about the greatest moments of life. If photography captures the greatest moments of life, poetry is the life behind them.
This entry was posted in The Internet Machine. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s