I’ve seen an interesting code base recently, where some arguments were passed to methods via comments.
It looked something like
/*
* @attribute default-method
*/
which would of course, declare the default method for a class being instantiated.
What is this? How is it done? Is there an example of this anywhere?
It was being used to control the format of returns, etc, so it certainly looked very interesting, and would certainly remove a lot of crap from classes I create.
As others has stated, it can be used to generate documentation.
However, you can certainly implement application logic (often reffered to as attributes or annotations) using this style of comments. Consider the following example:
You can then parse that comment and do whatever you want with the information.
In fact, Doctrine uses this “pattern” heavily.