Home

News

International

Screen Shots

Documentation

Download

Build

License

Credits

Contact

SourceForge Project

Tintware Documentation : Tint Programming Language : Tint Tutorial : Code vs Data

Code vs Data

While evaluating expressions, Tint keeps track of whether each character is code or data. Only text which has #( ) as code gets evaluated as a Tint expression. String blocks are always entirely data and procedure blocks are always entirely code. Whether the result of a primitive is code and/or data depends upon the particular primitive and the particular situation. The primitives, tint.data and tint.code, convert between data and code.

For example, given the following definitions, #(a-string) will evaluate to #(+,1,2,3,4) and #(a-proc) will evaluate to 10.

Def:String:a-string
[*]#(+,1,2,3,4)[*]
Def:Proc:a-proc
[*]#(+,1,2,3,4)[*]

Looking back to A Complete Program, the primitive tint.code was used. The result of #(%port.match,#(tint.byte,10)) is data. In order to evaluate the expression that was typed in by the user, it must be converted to code.

Keeping track of code and data is important for writing programs like web servers. After all, it would never due for someone to be able to submit an http request which was actually a Tint expression.