Using Eiffel (to write ASP.NET pages)


Eiffel handles inheritance in a different way than most languages. In C# or VB.NET the behavior of a newly introduced member in a class hierarchy is defined as part of the member declaration itself (for example C# will precede the member declaration with the keyword override to accomplish the same result as an Eiffel redefine clause). In Eiffel, classes are equipped with an inheritance clause which centralizes all the feature adaptations. As a result, Eiffel for ASP.NET introduces inheritance snippets. Each Eiffel ASP.NET page may include at most one inheritance snippet. Such a snippet must start with the inherit keyword and may then list any valid Eiffel feature adaptation.

String and Array Manifest Constants

The Eiffel programming language supports using manifest constants in source code. The type of these constants is inferred by the Eiffel compiler. There are two manifest constant types that require special attention on .NET: string and array. Because the Eiffel and the .NET types differ, writing code using string or array manifest constants requires additional care.

  • Strings: Eiffel strings cannot be mapped directly to .NET strings because Eiffel strings are mutable: an Eiffel string can be resized while the size of a .NET string is set for the lifetime of the object. However, the Eiffel class STRING defines conversion features that will automatically convert to and from a .NET string. So when the compiler expects an object of type System.String where an object of type STRING is used, it will automatically call the right conversion routine.

However if an instance of STRING is passed as an argument to an overloaded .NET function that can accept both an instance of System.Object or an instance of System.String then the compiler will produce an error since it has no means to know which type the Eiffel object should be converted to (any Eiffel object converts to System.Object). When this happens, the conversion function to_cil must be explicitely called.

  • Arrays: The exact same problem also arises with arrrays. Instances of the Eiffel class ARRAY are different from instances of NATIVE_ARRAY which correspond to the .NET array type. There are however features in ARRAY that will convert to and from .NET arrays. If an overloaded .NET function can take an argument of type System.Object or System.Array, any instance of ARRAY given to it must first be converted explicitly to a .NET array by calling the to_cil function.

Compilation and Timeouts

Eiffel compilations can take longer than the default timeouts set in ASP.NET. In particular ASP.NET will run batch compilations on the entire directory that is being accessed by IIS each time the time stamp of that directory changes. If the batch compilation takes longer than the batchTimeout property defined in the machine wide configuration file (machine.config) then ASP.NET will start another compilation just for the requested file. This can be quite resource intensive for the Web server and thus it might be beneficial to increase the default value of 15 seconds for batchTimeout.