of Things Baptiste Maingret*, Frédéric Le Mouël*, Julien Ponge*, Nicolas Stouls*, Jian Cao#, Yannick Loiseau% * University of Lyon, INSA Lyon, INRIA CITI Lab, France # Shanghai Jiao Tong University, China % Blaise Pascal University, France COP @ ECOOP - July 5 2015
agent for dynamic AOP Golo A lightweight dynamic language for the JVM [Jooflux] J. Ponge and F. Le Mouël. JooFlux: Hijacking Java 7 InvokeDynamic To Support Live Code Modifications. Research Report INRIA CITI Lab, INSA Lyon, 2012 https://github.com/dynamid/jooflux [Golo] J. Ponge, F. Le Mouël, and N. Stouls. Golo, a dynamic, light and efficient language for post-‐invokedynamic JVM. In Proceedings of the 11th International Conference on Principles and Practice of Programming in Java (PPPJ'2013), pp. 153– 158, Stuttgart, Germany, September 2013. http://golo-‐lang.org
• 100% Java compliant • Active academic and industrial community • Eclipse Incubating Technology Project https://projects.eclipse.org/projects/technology.golo/ June 2015 !
public void move(Direction dir) {…} public Position getPos() {...} layer ConfusedHeroLayer { //layer extension private Position getPos() {…} public void move(Direction dir) { proceed(dir); } private Direction getNewDir(Direction original) {if (original.isWest() then …} } } Context inside the main code Decision making inside the main code
Weather()] function Hero = || { return DynamicObject(): contexts([ConfusedHero, Weather]): # base function define("move", |this, dir| -‐> ...): ... define("move", |this, dir|@(ConfusedHero=TRUE) ={ proceed(dir) ... } } possibility to call the base function Context
function Hero = |decisionMaker| { return DynamicObject(): decisionmaker(decisionMaker) } let batman = Hero(misterPresident) Decision Making DecisionMaker API module scope decision-maker function referee several possible decision-makers
let god = DefaultDecisionMaker(){} let misterPresident = my.app.myDecisionMaker() misterPresident: global(true) #defining misterPresident as god let batman = Hero() #contextual object batman: move() #handle by misterPresident Decision Making defining global decision-maker
= |args| { … let context = context.TemperatureContext() let cm = ContextManager.INSTANCE() cm: register("Greenhouse", context) let dm = decisionmaker.GreenDecisionMaker() DecisionMakerManager.setDecisionMaker(dm) … } Smart farm main
= |args| { … var greenHouses = set[] for (var i = 0, i < greenHousePoolSize, i = i + 1){ greenHouses: add(GreenHouse()) } for (var i = 0, i < STEPS, i = i + 1) { Thread.sleep(DELAY) context: setValue(randomGen: nextInt(40)) foreach greenHouse in greenHouses { regulate(greenHouse) } } Smart farm main