80 likes | 239 Views
CLAM. Why new language? complexity : not all facilities of a common language new paradigm : inhibiting traditional computational programming megaprogramming : higher level focus on issues of composition , parallelism by asynchrony, and optimization Characteristics:
E N D
CLAM Why new language? • complexity: not all facilities of a common language • new paradigm: inhibiting traditional computational programming • megaprogramming: higher level • focus on issues of composition, parallelism by asynchrony, and optimization Characteristics: • purely compositional: no arithmetic, no I/O • splitting up of call statement: avoiding complexity of traditional call, faking asynchrony, allowing partial extraction, allowing monitoring of progress ==> see CPAM • optimization of composition: special primitives for cost estimation, monitoring of progress CHAIMS
Decomposing CALL Statements CALL gained functionality • Copying • Code sharing • Parameterized computation • Objects with overloaded method names • Remote procedure calls to distributed modules • Constrained (black box) access to encapsulated data progress in scale of computing CHAIMS decomposes CALL functions Setup Estimate Invoke Examine Extract CHAIMS
Primitives in CLAM Pre-invocation: SETUP: set up a connection to a megamodule SET-, GETPARAM: preset / get parameters in a megamodule ESTIMATE: get cost estimation for optimization Invocation and result gathering: INVOKE: start a specific method EXAMINE: test status and progress of an invoked method EXTRACT: extract results from an invoked method Termination: TERMINATE: terminate a method invocation TERMINATEALL: terminate the connection to a megamodule Control: WHILE, IF Assignment: = Shortcuts: EXWDONE, INVEX CHAIMS
Hiding Technical Details (1) CLAM provides high-level primitives that hide details. Protocol specific details are automatically generated. Example:mmh = SETUP(“megamodule”) Generated code for RMI: System.setSecurityManager(new RMISecurityManager()); ChaimsCompliantObject remote; try{remote=(ChaimsCompliantObject)Naming.lookup(url+mmname);} catch (Exception e){} try {remote.SETUP(clientID);} catch (Exception e){} CHAIMS
Hiding Technical Details (2) Generated code for CORBA (Orbix, C++ client): nameMM_var _pObj0; try {_pObj0=nameMM::_bind(":mmname","site");} catch (...) {} CHAIMSMMID mmid = _pObj0; pObj0->SETUP(mmid); Generated code for CORBA (Omnibroker, C++ client): CORBA_ORB_var orb = CORBA_ORB_init(argc,argv); // first get reference from a file and then convert it to an object const char* refFile_pObj0 = "io.ref"; ifstream in_pObj0; in_pObj0.open(refFile_pObj0); // error handling omitted here char stre_pObj0[1000]; in_pObj0 >> stre_pObj0; CORBA_Object_var obj_pObj0 = orb -> string_to_object(stre_pObj0); assert(!CORBA_is_nil(obj_pObj0)); // bind now to megamodule io_var _pObj0 = io::_narrow(obj_pObj0); assert(!CORBA_is_nil(_pObj0)); CHAIMSMMID mmid = _pObj0; pObj0->SETUP(mmid); CHAIMS
2. Invoke method "write" with result to be displayed General I/0Megamodule Megaprogram 1. Extract result to be displayed Megamodule Example General I/O-Megamodule - Output Corresponding code in CLAM: …………... // Setups, Invocations, ih1 is the handle of a // method of megamodule examples (myadress = adress_result) =ih1.EXTRACTWHENDONE() ih2= io.INVOKE("write", value = myadress, text ="Currently the adress is:") Every element of the data structure in parameter adress_result has besides the actual value also type information and descriptive name. Therefore, the general I/O-megamodule can display the parameter in a decent format without any further formatting information. CHAIMS
2. Invoke method "ask" with default values and type information Megaprogram General I/0Megamodule 3. Extract user-input 1. Get default type and value for desired parameter Megamodule Example 4. Invoke desired method with user-input General I/O-Megamodule - Input Corresponding code in CLAM: ex = SETUP("Example") io = SETUP("io") // io is the general I/O megamodule availabe in CHAIMS (myadress = adress)= ex.GETPARAM() io.INVOKE("ask", value = adress,text = "Please enter adress:") ih1= io.INVOKE("ask", value = myadress, text = "Please enter adress:") (myadress = result) =ih1.EXTRACTWHENDONE() ih2 = ex.INVOKE("method", adress = myadress) ….. CHAIMS