This is a direct manipulation programming system for object oriented programs.
- Class Declarations
Class JFrame Extends Container { title:Ref<String>, members:Ref<List<JComponent>>; setMembers(members){ this.members:=members }; setTitle(title){ this.title:=title ++ ">" }; }
- Data Structures
- String: "abc"
- Tuple:
(1,2)
- List:
[1,2,...,n]
(or,1::2::[]
)
- Arithmetic Expressions
- Binary Operator:
* / // + - ++ < > <= >= == && ||
- Unary Operator:
- ~
- Sequence
s1;s2
- Conditions
- If Statement:
If t1 then t2 else t3
- Case Statement:
case ls of
[] => []
| x :: xs => xs
- References
- Reference Creations: ref 3
- Dereferences: !r
- Assignments: t1:=t2
- Statements
var = term ;;
- Objects
- Field Access:
t.f
- Method Invocation:
(object->method) args
- Object Creations:
new Class([args])
Class JComponent Extends Object {}
Class JMenuItem Extends JComponent {
title:Ref<String>;
setTitle(title){
this.title:=title++"!!!"
};
}
Class JMenu Extends JMenuItem {
id:String,
items:List<JMenuItem>;
}
item1 = new JMenuItem([ref "Item1"]);;
item2 = new JMenuItem([ref "Item2"]);;
menu = new JMenu([ref "Menu", "menu-id", [item1, item2]]);;
main =
(item1->setTitle) "Menu-Item";
(menu->setTitle) "Test Menu";
menu;;
- Value Manipulations: Directly manipulating the text in the Output window or using the Develop Tool of the browser.
- Stucture Manipulations:
- Modify Types
- Adding Objects
- Deleting Objects
- git clone
- click oop-index.html
- elm make src/OOP/Main.elm --output=oop-elm.js