1 / 12

Implementation of Programming Languages

Implementation of Programming Languages. Modular type checking for AspectJ. Aspect-Oriented programming promotes to increase modularity Crosscutting code can be factored out into its own module, an aspect. Modular type checking for AspectJ.

Download Presentation

Implementation of Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Implementation of Programming Languages 4 January 2020 | Software Technology Group | 1

  2. Modular type checking for AspectJ • Aspect-Oriented programming promotes to increase modularity • Crosscutting code can be factored out into its own module,an aspect 4 January 2020 | Software Technology Group | 2

  3. Modular type checking for AspectJ pointcut setXY(FigureElement fe, int x, int y):call(void FigureElement.setXY(int, int))&& target(fe)&& args(x, y); after(FigureElement fe, int x, int y) returning:setXY(fe, x, y) { System.out.println(fe + " moved to (" + x + ", " + y + ")."); } What if method setXY is renamed? 4 January 2020 | Software Technology Group | 3

  4. Prob. 1: Fragile-Pointcut Problem Aspect fragile Pointcut Base Program Advice 4 January 2020 | Software Technology Group | 4

  5. Proposed solution Module Base Program Aspect Joinpoint Types Needs to bemaintained Advice Module Definition Binding:Joinpoint typesto pointcuts stable 4 January 2020 | Software Technology Group | 5

  6. Problem 2: around-advice and polymorphism //matches on any sub-type of Person, including Student void around(Person p) : call(* Person.*(..)) && target(p) { proceed( new Person() ); } Student s = new Student(); s.enrol(); //cannot enrol a general “Person” 4 January 2020 | Software Technology Group | 6

  7. Proposed Solution //matches on any sub-type of Person that is also a //super-type of student void around(Person p) : call(* Person.*(..)) && target(p) :void proceed(Student) { proceed( new Person() ); } Student s = new Student(); s.enrol(); //cannot enrol a general “Person” 4 January 2020 | Software Technology Group | 7

  8. Proposed Solution //does NOT match Student any more! void around(Person p) : call(* Person.*(..)) && target(p) { proceed( new Person() ); } Student s = new Student(); s.enrol(); //cannot enrol a general “Person” 4 January 2020 | Software Technology Group | 8

  9. Modular definition – Aspect side aspect DrawingLogger { joinpoint void settingXY(FigureElement fe, int x, int y); after settingXY(FigureElement fe, int x, int y) returning { System.out.println(fe + " moved to (" + x + ", " + y + ")."); } } 4 January 2020 | Software Technology Group | 9

  10. Modular definition – Base-Code side class FigureElement{ void setXY(int x, int y); } module Drawing { includes FigureElement; bind settingXY(FigureElement fe, int x, int y) to call(void FigureElement.setXY(int, int)) && target(fe) && args(x, y); } 4 January 2020 | Software Technology Group | 10

  11. Modular type checking for AspectJ Tasks • To address Problem 1 (Fragile-Pointcut Problem): • extend AspectBench Compiler (www.aspectbench.org) to: • provide new syntax for module definitions • implement binding of pointcuts to joinpoint-type definitions • implement corresponding type checks • To address Problem 2 (around-advice/polymorphism problem): • extend AspectBench Compiler to: • allow (generic) type bounds for around advice 4 January 2020 | Software Technology Group | 11

  12. What do you gain from this? • experience with a extending a real language in a real compiler • you can contribute your own ideas to the language design • possibly a publication later-on, if you want to 4 January 2020 | Software Technology Group | 12

More Related