230 likes | 448 Views
Languages for .NET: Eiffel. Raphael Simon (ISE) Emmanuel Stapf (ISE). Introduction. Initially (PDC 2000, ISE Eiffel 5.0): support for Eiffel subset Planned for 2002: full Eiffel implementation Integrated with the ISE Eiffel environment. Today: Eiffel. Used in financial institutions:
E N D
Languages for .NET: Eiffel Raphael Simon (ISE) Emmanuel Stapf (ISE)
Introduction • Initially (PDC 2000, ISE Eiffel 5.0): support for Eiffel subset • Planned for 2002: full Eiffel implementation • Integrated with the ISE Eiffel environment
Today: Eiffel • Used in financial institutions: • Chicago Board of Trade • Axa • CALFP • Used for simulation: • Battle field simulation (XonTech Inc) • Atmosphere simulation (EPA) • Payroll systems: • Groupe S • CAP Gemini (now Ernst&Young)
Today: Eiffel for .NET • Eiffel for .NET includes: • Major Eiffel language mechanisms • Contracts (assertions) • Exception handling • Genericity • Covariance • Does not include: • Agents (closures, cf. Delegates) • Multiple inheritance • Generic conformance
Eiffel libraries • EiffelBase compatible version for .NET • Uses interfaces to represent multiple inheritance used in EiffelBase • 100% compatible with EiffelBase at the client level • Uses natively .NET libraries (imported through the Assembly Manager)
.NET special additions to Eiffel • Extended indexing clauses to represent: • External names: names as they will be seen by the .NET world • Custom attributes • New class qualification to represent: • Sealed classes • .NET classes (imported from an assembly)
Indexing clauses: classes indexingexternal_name: "System.String" attribute:create {OBSOLETE_ATTRIBUTE} .make ("Use YY instead") end frozenexternal class MY_CLASS …
Indexing clauses: routines feature some_routine (i: INTEGER) isindexingexternal_name: "SomeRoutine" attribute:create {OBSOLETE_ATTRIBUTE} .make ("Use SomeOtherRoutine instead") end do … end
Old Eiffel class qualification An example: indexingdescription: "Sequence of characters" class STRING Simplified syntax: [expanded | deferred] class
New Eiffel class qualification An example: Indexing description: "Sequence of characters"external_name: "System.String" frozenexternalclass STRING Simplified syntax: [[frozen] [expanded] | deferred] [external] class
Accessing .NET facilities • Creation of the assembly manager to automatically generate Eiffel class skeleton to access .NET facilities • New Eiffel external syntax to access .NET members. • to_string: STRING is external "IL signature ():System.String use System.String" alias "ToString" end
Accessing .NET facilities • Properties: Assembly Manager will generate the get_xx and set_xx features associated to the `xx' property . • Events: same as properties, we generate the add_xx, remove_xx and fire_xx features. • Overloaded methods: Assembly Manager will generate a different name visible at the Eiffel level kept consistently by the Assembly Manager.
Eiffel: a first class CLS citizen • CLS: Common Language Specification • Language interoperability achieved through a set of CLS rules • .NET library authors should know about CLS • Consumers and producers targeting .NET should know about CLS
Eiffel constructs seen from CLS • Attributes are generated as properties • Generic classes: one .NET class per generic derivation of expanded types and one .NET class for all generic derivation of reference types. LIST [INTEGER] -> LIST_System_Int32 LIST [CHARACTER] -> LIST_System_Char LIST [ANY] -> LIST_System_Object
CLS issues • Eiffel creation routines do not match CLI constructors: • Two creation routines might have the same signature • Creation routine need not call the parent creation routine • Hard to consume `byref' parameter • Eiffel features exportation rules are different of the CLI ones.
Eiffel issues • Multiple inheritance of classes is not yet supported. Many possible ways: • Implementation of your own dynamic dispatch. Barely usable for other CLS languages. • Promote all multiply inherited classes to interfaces. Performance penalty and behavior differences.
Multiple inheritance through interfaces • Inconvenience of using the interface definition instead of the class directly. • Performance penalty: • every call is virtual instead of being optimized • inlining becomes difficult
f A g h B C D select g Multiple inheritance through interfaces • Behavior of repeated inheritance is not identical: c: C; d: Dc := dc.h ?? In Eiffel:version g of D (inherited from B) is called In .NET:version h of D (inherited from C) is called
Verifiability • Default generation is verifiable • User can specify otherwise: • For better performance • For private usage
Eiffel for .NET future addition • Creation of .NET properties • Creation of .NET events • Creation of new type of Delegates
Eiffel and Eiffel for .NET • Calling Eiffel from Eiffel for .NET: • Creating COM components of existing Eiffel application • Direct calls to Eiffel C generated code automatically handled by the Eiffel for .NET compiler • Calling Eiffel for .NET from Eiffel: • Using COM interop
.NET Wizard • Helps start a new Eiffel for .NET project • Integrated into EiffelStudio
Assembly Manager • Available at any time from EiffelStudio • Allows to: • Edit external classes feature names • Import new assemblies in the Eiffel Assembly Cache (EAC) • Remove assemblies from the EAC