Saturday, February 26, 2011

Applied Types

Chris Double is again exploring ATS, a language with a very advanced type system:
ATS did save me from some errors in my larger program that this snippet can be used to demonstrate:
  • The read call must not read more data than the size of the buffer allows.
  • The conversion to a C string in-place means we need to read one less than the size of the buffer.
  • The file must be closed after use.

All these issues resulted in compile time errors. [!]

No comments: