Aspect-oriented programming with type classes

@inproceedings{Sulzmann2007AspectorientedPW,
  title={Aspect-oriented programming with type classes},
  author={Martin Sulzmann and Meng Wang},
  booktitle={FOAL},
  year={2007}
}
We consider the problem of adding aspects to a strongly typed language which supports type classes. We show that type classes as supported by the Glasgow Haskell Compiler can model an AOP style of programming via a simple syntax-directed transformation scheme where AOP programming idioms are mapped to type classes. The drawback of this approach is that we cannot easily advise functions in programs which carry type annotations. We sketch a more principled approach which is free of such problems… 

Figures from this paper

A Compilation Model for Aspect-Oriented Polymorphically Typed Functional Languages

A type-directed weaving scheme that coherently weaves type-scoped advices into the base program at compile time is presented and the correctness of the static weaving with respect to the operational semantics of AspectFun is state.

A typed monadic embedding of aspects

The use of monads brings type-based reasoning about effects for the first time in the pointcut/advice setting, thereby practically combining Open Modules and EffectiveAdvice, and enables modular extensions of the aspect language.

Monadic Embedding of Aspects

The use of monads brings type-based reasoning about effects for the first time in the pointcut/advice setting, thereby practically combining Open Modules and EffectiveAdvice, and enables modular extensions of the aspect language.

Effective Aspects: A Typed Monadic Embedding of Pointcuts and Advice

This work brings type-based reasoning about effects for the first time in the pointcut/advice model, in a framework that is both expressive and extensible; thus allowing development of robust aspect-oriented systems as well as being a useful research tool for experimenting with new aspect semantics.

Effective aspects : A typed monadic model to control and reason about aspect interference. (Effective aspects : Un modèle monadique et typé pour contrôler l'interférence entre aspects)

This work brings type-based reasoning about effects for the first time in the pointcut/advice model of AOP in a framework that is expressive, extensible and well-suited for development of robust aspect-oriented systems as well as a research tool for new aspect semantics.

A TYPED MONADIC MODEL TO CONTROL AND REASON ABOUT ASPECT INTERFERENCE TESIS PARA OPTAR AL GRADO DE DOCTOR EN CIENCIAS, MENCION COMPUTACIÓN EN COTUTELA CON LA ÉCOLE DES MINES DE NANTES

This work presents EffectiveAspects: a novel approach to embed the pointcut/advice model of AOP in a statically-typed functional programming language like Haskell, and proves a general equivalence theorem that is based on a few conditions that can be established, reused, and adapted separately as the system evolves.

Type-Safe Layer-Introduced Base Functions with Imperative Layer Activation

This paper proposes a COP framework in Haskell that supports both imperative and dynamically-scoped layer activation mechanisms, as well as layer-introduced base functions, and shows how the framework encodes COP features in Haskell using a simple example.

Transactions on Aspect-Oriented Software Development XI

SAGA is introduced, a general framework that provides a smooth integration of the specification and the run-time checking of both data and protocoloriented properties of Java classes and interfaces and is evaluated by conducting an industrial case study from an eCommerce software company Fredhopper.

Comparative Studies of 10 Programming Languages within 10 Diverse Criteria - a Team 10 COMP6411-S10 Term Report

This survey work involves a comparative study of these ten programming languages with respect to the following criteria: secure programming practices, web application development, web service composition, OOP-based abstractions, reflection, aspect orientation, functional programming, declarative programming, batch scripting, and UI prototyping.

Comparative Studies of 10 Programming Languages within 10 Diverse Criteria -- a Team 7 COMP6411-S10 Term Report

This paper discusses ten programming languages: C++, C#, Java, Groovy, JavaScript, PHP, Schalar, Scheme, Haskell and AspectJ, and concludes that which languages are suitable and which are not for using in some cases.

References

SHOWING 1-10 OF 43 REFERENCES

Type-directed weaving of aspects for higher-order functional languages

This work gives a source-level type inference system for a higher-order, polymorphic language coupled with type-scoped pointcuts and presents a type-directed translation scheme which resolves all advice applications at static time.

Type classes in Haskell

A set of type inference rules for resolving overloading introduced by type classes, as used in the functional programming language Haskell, are defined, using second-order lambda calculus to record type information in the transformed program.

Good advice for type-directed programming aspect-oriented programming and extensible generic functions

This solution not only avoids the limitations present in Lämmel and Peyton Jones's technique, but also allows type-directed functions to be extended at any time with cases for types that were not even known at compiletime, critical to writing programs that make use of dynamic loading or runtime type generativity.

Aspectual Caml: an aspect-oriented functional language

The design and implementation issues of those AOP mechanisms that give insights into the interaction between AOP features and common features in strongly-typed functional languages such as type inference, polymorphic types and curried functions are described.

Type Classes with Functional Dependencies

The kind of problems that can occur with multiple parameter type classes are illustrated, and how they can be resolved by allowing programmers to specify explicit dependencies between the parameters are explained.

A theory of aspects

It is argued that this framework is an effective way to give semantics to aspect-oriented programming languages in general because the translation eliminates shallow syntactic differences between related constructs and permits definition of a clean, easy- to-understand, and easy-to-reason-about core language.

Semantics of type classes revisited

These ideas are applied to investigate the appropriateness of Haskell-style type inference which uses backward chaining for inference of instance relationships, and it is shown that Haskell's algorithm turns out to imply a least fixed point semantics for classes.

A system of constructor classes: overloading and implicit higher-order polymorphism

A flexible type system which combines overloading and higher-order polymorphism in an implicitly typed language using a system of constructor classes – a natural generalization of type classes in Haskell is described.

PolyAML: a polymorphic aspect-oriented functional programming language

PolyAML is defined, a typed functional, aspect-oriented programming language that allows programmers to define type-safe polymorphic advice using pointcuts constructed from a collection of polymorphic join points and comes equipped with a type inference algorithm that conservatively extends Hindley-Milner type inference.

Parametric Overloading in Polymorphic Programming Languages

This paper defines the concept of parametric overloading as a restricted form of overloading which is easily combined with parametric polymorphism, thereby allowing the design of efficient type inference algorithms.