11.05.2002 11:46 PM
This is a small nit with Eiffel - at least it doesn't make a lot of sense to me. Take a look at the following method:
.method public hidebysig newslot virtual
SetBinary([in] class EiffelSolarSystem.RootCluster.Star binary)
IL_0002: castclass EiffelSolarSystem.RootCluster.Star
IL_0007: callvirt instance void
Now, the type of the argument is
EiffelSolarSystem.RootCluster.Star. So why is a
castclass showing up at
IL_0002? Unless I'm missing some aspect about this opcode, all it's going to do is cast the given object to the desired type. But in this case, you're guaranteed to have the object as
EiffelSolarSystem.RootCluster.Star! If you try to pass in a
System.Object object, that won't even compile.
This happens when you declare the argument as
set_binary(binary: like Current) is
binary_star := binary
It seems like you could cut out the 2nd and 3rd opcodes altogether. Anybody see a reason why this may be beneficial?
Oh, if you want to have some fun, create a generic class in Eiffel and try to use it in C#. Something like this:
-- Eiffel code goes here...
Using it in Eiffel is painless. Using it in C# takes some exploring :).
* Posted at 11.05.2002 11:46:00 PM CST | Link *