Creating Aspects (Cirrus)
Cirrus is an infrastructure for Aspect-Oriented Programming (AOP) using the Elements compiler, available in all languages except Go.
Cirrus extends the attributes system with full support for Aspect-Oriented Programming, Like regular attributes, aspects annotate a class or one of it's members. But wile plain attributes can only affect build-in compiler changes (for a few well-defined ones) or leave static meta-data that can be inspected at runtime by , Aspects can take an active role in then compile process, allowing your own code to run and adjust the emitted binary as you need.
Separation of Concerns
This is great for allowing you to separate concerns such as logging, security or other functionality orthogonal to the regular class hierarchy into Aspects that can be attached to classes or their members, as needed.
Functionality that otherwise would need to be reimplemented in various places across an application or framework can be encapsulated in reusable form and maintained in a single place. Elements allows developers both to reuse existing aspects written by third parties or included with the compiler’s standard aspect library, as well as to create their own aspects.
Aspects can only be implemented using the .NET platform (using any of the OOP languages in Elements). They can then be applied to code for any of the four platforms, .NET, Cocoa, Java and Island.
Aspects can be applied in all languages except Go, using the same syntax as for regular attributes. On Oxygene and C# this is done by enclosing the aspect name in square brackets (
[SomeAspect]), in Swift and Java by prefixing it with an "at" symbol (
@SomeAspect), and in Mercury using angle brackets (