Presentation is loading. Please wait.

Presentation is loading. Please wait.

June 1998 CHAIMS1 CLAM Why new language? –complexity: not all facilities of a common language –new paradigm: inhibiting traditional computational programming.

Similar presentations


Presentation on theme: "June 1998 CHAIMS1 CLAM Why new language? –complexity: not all facilities of a common language –new paradigm: inhibiting traditional computational programming."— Presentation transcript:

1

2 June 1998 CHAIMS1 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

3 June 1998 CHAIMS2 Decomposing CALL Statements 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 Extract InvokeEstimateExamineSetup CHAIMS decomposes CALL functions CALL gained functionality

4 January 1999 CHAIMS3 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 TERMINATE: terminate a method invocation TERMINATEALL: terminate the connection to a megamodule Termination: Control: WHILE, IF Assignment: = Shortcuts: EXWDONE, INVEX

5 January 1999 CHAIMS4 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){}

6 January 1999 CHAIMS5 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);

7 January 1999 CHAIMS6 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. Megaprogram General I/0 Megamodule Megamodule Example 2. Invoke method "write" with result to be displayed 1. Extract result to be displayed

8 January 1999 CHAIMS7 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) ….. Megaprogram General I/0 Megamodule Megamodule Example 2. Invoke method "ask" with default values and type information 3. Extract user-input 4. Invoke desired method with user-input 1. Get default type and value for desired parameter


Download ppt "June 1998 CHAIMS1 CLAM Why new language? –complexity: not all facilities of a common language –new paradigm: inhibiting traditional computational programming."

Similar presentations


Ads by Google