N9I - 2/25/2010
Written on Fri, 26 Feb 2010 06:45:06 +0000 - Last updated on Fri, 26 Feb 2010 07:01:28 +0000A journal entry in the development of the N9I programming language, dated February 25, 2010
Revision to annotation syntax
In the following notes:
- N9I - 2/4/2010
- N9I - 2/5/2010
- N9I - 2/8/2010
- N9I - 2/12/2010
a language feature called "annotations" is discussed. Annotations provide a way for programmers to attach metadata to logical code units, such as methods and classes. In N9I, annotations are used primarily for three functions:
- to declare setters and getters for object properties (N9I - 2/4/2010),
- to provide methods for transforming between types (N9I - 2/5/2010, N9I - 2/12/2010),
- to add specialized validation to method parameters (N9I - 2/8/2010).
Annotations apply to the unit of code directly following them. Annotations can be stacked.
In prior notes, the syntax for annotations was given as
#@annotation value
However, it is my opinion that this looks either like a comment or a preprocessor directive, not actual code. Therefore, to borrow from C# a little bit, the syntax for N9I annotations shall instead be:
[@annotation value]