Adapting EiffelStudio to FreeELKS and built_in features

by Emmanuel Stapf (modified: 2007 Feb 27)

As of version, EiffelStudio can compile against either EiffelBase or FreeELKS. "FreeELKS is a joint effort between Eiffel Software and Eric Bezault to provide a compiler independent implementation of the ELKS classes. Currently FreeELKS is based on EiffelBase with minor modifications so that it can be compiled by more than one compiler, currently EiffelStudio and gec.
The way FreeELKS works is by turning all features, that do not have a pure Eiffel implementation or that are handled specifically by a compiler, into external "built_in" features. For example, in ANY, the twin query now looks like:

frozen twin: like Current is -- New object equal to `Current' -- `twin' calls `copy'; to change copying/twining semantics, redefine `copy'. external "built_in" ensure twin_not_void: Result /= Void is_equal: Result.is_equal (Current) end

The current version of FreeELKS is not yet ready for release since it is an ongoing development but once the first version is available, it will be the default library used by EiffelStudio. The original EiffelBase will still be present for backward compatibility in case FreeELKS introduces some breaking changes.

For those interested in how it works, here are some insights for the implementation in EiffelStudio. In the EiffelStudio delivery under $ISE_EIFFEL/studio you have a new directory built_ins with 3 subdirectories:

  • dotnet: implementation of built_ins for .NET
  • classic: implementation of built_ins for classic Eiffel
  • neutral: implementation that is common to .NET and classic

For each built_in feature, it will find its implementation in an Eiffel class located in one of the above directory. The lookup always start with the specific implementation (either .NET or classic) and then the neutral one. If no implementation can be found, the built_in feature is transformed into a C external whose alias is `eif_builtin_CLASS_NAME_feature_name' and an implementation must be provided by the runtime.

Let's take the {ANY}.twin example which has a different implementation between .NET and classic. In classic mode, the compiler will try to load the class whose file name is ANY.e in the classic directory. Once loaded and parsed, it will lookup the `twin' feature in it and takes the Eiffel implementation as the implementation of {ANY}.twin.

When looking at the flat form of a built_in feature or when stepping into a built_in routine, EiffelStudio will show you the Eiffel code corresponding to the implementation and not the `external "built_in"' body. Therefore you can even put a breakpoint in those routines.

That's all there is to know about built_in features support in EiffelStudio.