
Few newbie syntax questions
On Mon, 18 Oct 1999 10:55:36 +0200,
Quote:
>1) Is there anything similar to namespaces/packages in eiffel ? I can
>just prefix class names with package abbreviation (which seems to be
>case in few eiffel libraries I've seen), but it is not scalable and with
>longer prefixes can be tiring to type in.
No. Eiffel intentionally uses the class as only organisatorical unit.
Classes can be grouped into clusters though. In case of name clashes,
most compilers offer a mechanism to rename classes at compile time. In
case you are using ISE Eiffel, this can be done in the Ace files using
the "adapt/rename" meachnism.
Quote:
>2) Is there any way to force variable to be reference type if class is
>defined as expanded ? (Opposite of expanded keyword in variable
>definition).
Non-expanded typed are always reference types.
Quote:
>3) Let's suppose that there is class A, class B inheriting from A, class
>X, class Y inheriting from X. Class Y has method onlyInY. Class A has
>method m(x:X). Class B redefines method m using covariance to m(y:Y) and
>calls onlyInY inside this method.
>Now somewhere in program we have variable a:A; , which is in fact
>instance of B (real type was lost somewhere due to parameter passing,
>storing in array or anything). Now I call a.m(x). B.m() should be used I
>think - it is redefined after all. But B.m() relies on features that
>appear only in Y. Something is broken. How eiffel resolves that ?
If I understand your description right, we have a so-called polymorphic
catcall. There have been some efforts to detect such calls at compile
time, but no compiler-enforcable rules have been found yet. In the
chapter about typing in OOSC2, you find more information on this issue.
Best regards,
Patrick
--
----------------------------------------
Patrick Schoenbach
Interactive Software Engineering, Inc.
URL: http://www.eiffel.com