Let there be a small language for creating annotations. (The actual case in point is section 7.4.15 in OMG IDL4, http://www.omg.org/spec/IDL/4.1/PDF).
Some annotations are predefined. In order to support both predefined annotations and user defined annotations, I would use an array, e.g.:
sub ULONG () { 9 } sub ENUM () { 23 } my @annotations = ( [ "id", [ ULONG, "value", undef ] ], [ "autoid", [ ENUM, "AutoidKind", [ "SEQUENTIAL", "HASH" ] ], [ $annotations[1]->[1], "value", "HASH" ] ] );
The idea is that the array is initialized with the predefined annotations, and user defined annotations are parsed and appended onto the same array later on.
In the example above, the predefined annotation autoid first defines an enum type AutoidKind with values SEQUENTIAL and HASH, and then shall define a parameter named value of the enum type just defined.
The notation $annotations[1]->[1] for referencing the enum type does not work - probably because the declaration @annotations is still in progress at the point of reference.
Perhaps there is a different way to achieve what I am trying to do?
Thanks.In reply to how to name an anonymous reference by omkellogg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |