languages for.net: eiffel raphael simon (ise) emmanuel stapf (ise)

23
Languages for .NET: Languages for .NET: Eiffel Eiffel Raphael Simon (ISE) Raphael Simon (ISE) Emmanuel Stapf (ISE) Emmanuel Stapf (ISE)

Post on 19-Dec-2015

244 views

Category:

Documents


6 download

TRANSCRIPT

Languages for .NET: EiffelLanguages for .NET: Eiffel

Raphael Simon (ISE)Raphael Simon (ISE)

Emmanuel Stapf (ISE)Emmanuel Stapf (ISE)

IntroductionIntroduction

Initially (PDC 2000, ISE Eiffel 5.0): support Initially (PDC 2000, ISE Eiffel 5.0): support for Eiffel subsetfor Eiffel subset

Planned for 2002: full Eiffel Planned for 2002: full Eiffel implementationimplementation

Integrated with the ISE Eiffel environmentIntegrated with the ISE Eiffel environment

Today: EiffelToday: Eiffel

Used in financial institutions:Used in financial institutions: Chicago Board of TradeChicago Board of Trade AxaAxa CALFPCALFP

Used for simulation:Used for simulation: Battle field simulation (XonTech Inc)Battle field simulation (XonTech Inc) Atmosphere simulation (EPA)Atmosphere simulation (EPA)

Payroll systems:Payroll systems: Groupe SGroupe S CAP Gemini (now Ernst&Young)CAP Gemini (now Ernst&Young)

Today: Eiffel for .NETToday: Eiffel for .NET

Eiffel for .NET includes:Eiffel for .NET includes: Major Eiffel language mechanismsMajor Eiffel language mechanisms Contracts (assertions)Contracts (assertions) Exception handlingException handling GenericityGenericity CovarianceCovariance

Does not include:Does not include: Agents (closures, cf. Delegates)Agents (closures, cf. Delegates) Multiple inheritanceMultiple inheritance Generic conformanceGeneric conformance

Eiffel librariesEiffel libraries

EiffelBase compatible version for .NETEiffelBase compatible version for .NET Uses interfaces to represent multiple Uses interfaces to represent multiple

inheritance used in EiffelBaseinheritance used in EiffelBase 100% compatible with EiffelBase at the client 100% compatible with EiffelBase at the client

levellevel Uses natively .NET libraries (imported Uses natively .NET libraries (imported

through the Assembly Manager)through the Assembly Manager)

.NET special additions to Eiffel.NET special additions to Eiffel

Extended indexing clauses to represent:Extended indexing clauses to represent: External names: names as they will be seen External names: names as they will be seen

by the .NET worldby the .NET world Custom attributesCustom attributes

New class qualification to represent:New class qualification to represent: Sealed classesSealed classes .NET classes (imported from an assembly).NET classes (imported from an assembly)

Indexing clauses: classesIndexing clauses: classes

indexingindexingexternal_name: "System.String"external_name: "System.String"attribute:attribute:

createcreate {OBSOLETE_ATTRIBUTE} {OBSOLETE_ATTRIBUTE}.make ("Use YY instead") .make ("Use YY instead") endend

frozenfrozen externalexternal class classMY_CLASSMY_CLASS

……

Indexing clauses: routinesIndexing clauses: routines

featurefeature

some_routine (i: INTEGER) issome_routine (i: INTEGER) isindexingindexing

external_name: "SomeRoutine"external_name: "SomeRoutine"attribute:attribute:

createcreate {OBSOLETE_ATTRIBUTE} {OBSOLETE_ATTRIBUTE}.make ("Use SomeOtherRoutine instead") .make ("Use SomeOtherRoutine instead") endend

dodo……

endend

Old Eiffel class qualificationOld Eiffel class qualification

[[expandedexpanded | | deferreddeferred] ] classclass

Simplified syntax:Simplified syntax:

An example:An example:

indexingindexingdescription: "Sequence of characters"description: "Sequence of characters"

classclassSTRINGSTRING

New Eiffel class qualificationNew Eiffel class qualification

IndexingIndexingdescription: "Sequence of characters"description: "Sequence of characters"external_name: "System.String"external_name: "System.String"

frozenfrozen externalexternal classclassSTRINGSTRING

[[[[frozenfrozen] [] [expandedexpanded] | ] | deferreddeferred] [] [externalexternal] ] classclass

Simplified syntax:Simplified syntax:

An example:An example:

Accessing .NET facilitiesAccessing .NET facilities

Creation of the assembly manager to Creation of the assembly manager to automatically generate Eiffel class automatically generate Eiffel class skeleton to access .NET facilitiesskeleton to access .NET facilities

New Eiffel external syntax to access .NET New Eiffel external syntax to access .NET members.members.

to_string: STRINGto_string: STRING is isexternalexternal

""IL IL signaturesignature ():System.String ():System.String useuse System.String System.String""aliasalias

""ToStringToString""endend

Accessing .NET facilitiesAccessing .NET facilities

Properties: Assembly Manager will Properties: Assembly Manager will generate the get_xx and set_xx features generate the get_xx and set_xx features associated to the `xx' property .associated to the `xx' property .

Events: same as properties, we generate Events: same as properties, we generate the add_xx, remove_xx and fire_xx the add_xx, remove_xx and fire_xx features.features.

Overloaded methods: Assembly Overloaded methods: Assembly Manager will generate a different name Manager will generate a different name visible at the Eiffel level kept consistently visible at the Eiffel level kept consistently by the Assembly Manager.by the Assembly Manager.

Eiffel: a first class CLS citizenEiffel: a first class CLS citizen

CLS: Common Language SpecificationCLS: Common Language Specification Language interoperability achieved Language interoperability achieved

through a set of CLS rulesthrough a set of CLS rules .NET library authors should know about .NET library authors should know about

CLSCLS Consumers and producers Consumers and producers

targeting .NET should know about CLStargeting .NET should know about CLS

Eiffel constructs seen from CLSEiffel constructs seen from CLS

Attributes are generated as propertiesAttributes are generated as properties Generic classes: one .NET class per generic Generic classes: one .NET class per generic

derivation of expanded types and one .NET derivation of expanded types and one .NET class for all generic derivation of reference class for all generic derivation of reference types.types.

LIST [INTEGER]LIST [INTEGER] ->-> LIST_System_Int32LIST_System_Int32

LIST [CHARACTER]LIST [CHARACTER] ->-> LIST_System_CharLIST_System_Char

LIST [ANY]LIST [ANY] ->-> LIST_System_ObjectLIST_System_Object

CLS issuesCLS issues

Eiffel creation routines do not match CLI Eiffel creation routines do not match CLI constructors:constructors: Two creation routines might have the same Two creation routines might have the same

signaturesignature Creation routine need not call the parent Creation routine need not call the parent

creation routinecreation routine Hard to consume `byref' parameterHard to consume `byref' parameter Eiffel features exportation rules are Eiffel features exportation rules are

different of the CLI ones.different of the CLI ones.

Eiffel issuesEiffel issues

Multiple inheritance of classes is not yet Multiple inheritance of classes is not yet supported. Many possible ways:supported. Many possible ways: Implementation of your own dynamic Implementation of your own dynamic

dispatch. Barely usable for other CLS dispatch. Barely usable for other CLS languages.languages.

Promote all multiply inherited classes to Promote all multiply inherited classes to interfaces. Performance penalty and interfaces. Performance penalty and behavior differences.behavior differences.

Multiple inheritance through interfacesMultiple inheritance through interfaces

Inconvenience of using the interface Inconvenience of using the interface definition instead of the class directly. definition instead of the class directly.

Performance penalty:Performance penalty: every call is virtual instead of being optimizedevery call is virtual instead of being optimized inlining becomes difficultinlining becomes difficult

Multiple inheritance through interfacesMultiple inheritance through interfaces

Behavior of repeated inheritance is not Behavior of repeated inheritance is not identical:identical:

A

CB

D

f

g h

select g

c: C; d: Dc: C; d: Dc := dc := dc.h ??c.h ??

In Eiffel:In Eiffel:version g of D (inherited from B) is calledversion g of D (inherited from B) is called

In .NET:In .NET:version h of D (inherited from C) is calledversion h of D (inherited from C) is called

VerifiabilityVerifiability

Default generation is verifiableDefault generation is verifiable User can specify otherwise:User can specify otherwise:

For better performanceFor better performance For private usageFor private usage

Eiffel for .NET future additionEiffel for .NET future addition

Creation of .NET propertiesCreation of .NET properties Creation of .NET eventsCreation of .NET events Creation of new type of DelegatesCreation of new type of Delegates

Eiffel and Eiffel for .NETEiffel and Eiffel for .NET

Calling Eiffel from Eiffel for .NET:Calling Eiffel from Eiffel for .NET: Creating COM components of existing Eiffel Creating COM components of existing Eiffel

applicationapplication Direct calls to Eiffel C generated code Direct calls to Eiffel C generated code

automatically handled by the Eiffel for .NET automatically handled by the Eiffel for .NET compilercompiler

Calling Eiffel for .NET from Eiffel:Calling Eiffel for .NET from Eiffel: Using COM interopUsing COM interop

.NET Wizard.NET Wizard

Helps start a new Eiffel for .NET projectHelps start a new Eiffel for .NET project Integrated into EiffelStudioIntegrated into EiffelStudio

Assembly ManagerAssembly Manager

Available at any time from EiffelStudioAvailable at any time from EiffelStudio Allows to:Allows to:

Edit external classes feature namesEdit external classes feature names Import new assemblies in the Eiffel Assembly Import new assemblies in the Eiffel Assembly

Cache (Cache (EACEAC)) Remove assemblies from the EACRemove assemblies from the EAC