Article View: comp.lang.eiffel
Article #1143global variable in Eiffel (was Re: whither style)
From: Jean-Marc Jezequel
Date: Tue, 09 Jan 1996 08:48
Date: Tue, 09 Jan 1996 08:48
34 lines
1841 bytes
1841 bytes
In article <4ct8s9$477@disunms.epfl.ch>, Stephane.Barbey@di.epfl.ch (Stephane Barbey) writes: >In article <60SqRiBF3RB@herold.franken.de>, jhd@herold.franken.de (Joachim Durchholz) writes: >: There is definitely no such thing as a global variable in Eiffel. >: > >What about attributes defined in the classes ANY (and also in HERE in a >previous version of Eiffel)? Such attributes are not global variables: only they are inherited by all classes in an Eiffel Universe (not a recommanded thing to do then). But you can *build* global variables if you need them: declare a once function returning the global variable in the class ANY. Expl: class ANY global_integer: INTEGER_REF is -- global variable, i.e. shared by all objects once !!Result end -- global_integer end -- ANY In Eiffel, this is however seldom useful. More useful is to use the same mecanism to share variables among a few number of classes. -- Jean-Marc Jezequel Tel : +33 99847192 IRISA/CNRS Fax : +33 99847171 Campus de Beaulieu e-mail : jezequel@irisa.fr F-35042 RENNES (FRANCE) http://www.irisa.fr/pampa/PROF/jmj.html
Technical Details
Message-ID:
<4cta59$h9@news.irisa.fr>Path:
arc1-ca.pugleaf.net!irisa.fr!usenetReferences:
<cmanDK7x13.5KM@netcom.com> <30e26364.2569895@news1.wolfe.net> <60SqRiBF3RB@herold.franken.de> <4ct8s9$477@disunms.epfl.ch>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!irisa.fr!usenet From: jezequel@stormbringer.irisa.fr (Jean-Marc Jezequel) Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.c,comp.lang.c++,comp.lang.modula2,comp.lang.modula3,comp.lang.smalltalk Subject: global variable in Eiffel (was Re: whither style) Date: 9 Jan 1996 08:48:41 GMT Organization: Irisa, Rennes (FR) Sender: jezequel@irisa.fr (Jean-Marc Jezequel) Distribution: world Message-ID: <4cta59$h9@news.irisa.fr> References: <cmanDK7x13.5KM@netcom.com> <30e26364.2569895@news1.wolfe.net> <60SqRiBF3RB@herold.franken.de> <4ct8s9$477@disunms.epfl.ch> NNTP-Posting-Host: stormbringer.irisa.fr