Annotations

The original annotation that started this project is @Pure. This would be applied to methods, and I think the proper definition is that a method is pure only if it does not change any state at all (either in the target object or anywhere else) and its return value depends only on the state of the parameters to the method call and the target object. This requires that the method not call any other methods that are not also marked as @Pure.

To determine when the state of objects might change, it will also be necessary to mark appropriate methods as @Const. This will mean that the method does not change the state of the target object, just like const functions in C++.

This is still not enough, however, as there could be aliases to the object in question which could be used to change it in a way that cannot easily be tracked at compile-time. As an initial way to work around this problem (in very limited circumstances), classes will be marked as @Immutable to mean that they can never be changed at all. This will allow me to make a start on making some optimisations and think further about better solutions.

Advertisements

Tags: , , ,

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

w

Connecting to %s


%d bloggers like this: