Certain issues inevitably come up when programming:

  • How do I test my program?
  • How do I keep track of what my program is doing?
  • What system resources does my program gobble up?

To support dealing with these issues, Babel-17 has pragmas. Pragmas can be placed everywhere in a Babel-17 program where a statement could be placed, too. Currently there are three pragmas available:

#log expr

This logs a string representation of the value expr evaluates to.

#assert condition

This evaluates the condition and checks if the result is true. If not so, an assertion failure results.

#profile expr

This evaluates expr and profiles the evaluation. Right now just the time that the evaluation takes is measured, but of course more detailed information like memory consumption etc. would be nice.

The details of the execution of pragmas depend on the Babel-17 runtime environment the program is in. Usually, this environment should provide mechanisms to ignore pragmas or to customize them, for example in order to determine where the logging information goes, or if a failed assertion should stop the program and so on.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: