« Why We Need a Web Control Stack | Main | Progress: Web Stack Implemented »

A Case for Reflection in HOT Languages

In a language for the web, one ought to be able to serialize data at will, it ought to be easy to do so, and one ought to be able to write various serializers that have different properties of speed and compactness. In typical statically-typed languages, doing this is rather involved, whereas it's quite easy and commonplace in dynamically-typed languages.

To that end, a HOT language should provide primitives which will accept a value of any type, and return information such as:

  • the value's specific type
  • the "kind" of the type, e.g.: basic type, record, variant, list, function
  • for a variant value: the constructor (as a first-class value), and its arguments
  • for a record value: the labels of the fields, and a way of getting their values

If the type system is preventing us from doing something which is perfectly safe, sane and desirable, then the type system should be changed.

I have some ideas how to type operations like the above; I'll work it out and get back to you.

Post a comment