"down-casting" in Eiffel
I am new to Eiffel and have worked through the book: "Touch of Class". Great book. I am now looking forward to writing more substantial code in Eiffel.
While playing around with the language I came across the need to "cast" the type of a list from a more general type to a more specific type. The mechanism I came up with is a re-usable component:
Using this CAST class looks like this:
As I am new to Eiffel, I would like more experienced developers to guide me in this pattern. Is there a better (more idiomatic) way of doing this type of down-casting in Eiffel? It is something I need to do a lot because of the type of code I am writing. Some of the down-casting can be replaced by the Visitor design pattern, but the Visitor pattern will not always work and I need to do narrowing-casts.
Any comments are appreciated.