Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!pyrltd!root44!hrc63!mrcu!uk.co.gec-mrc!paj From: paj@uk.co.gec-mrc (Paul Johnson) Newsgroups: comp.lang.eiffel Subject: Create once. Message-ID: <714@puck.mrcu> Date: 22 Nov 90 14:18:38 GMT Sender: paj@mrcu Reply-To: paj@uk.co.gec-mrc (Paul Johnson) Organization: GEC-Marconi Research Centre, Great Baddow, Essex Lines: 23 What happens if you define a "Create" procedure in an Eiffel class as a "once" procedure? The book (Eiffel: The Language 2.2) does not seem to say. If it is not defined, may I propose the following semantics: Given a class FOO with "Create is once....end", and some other class containing a variable foo:FOO, then the first "foo.Create" should create an instance of FOO and set foo to refer to it. Subsequent "foo.Create"s should simply set foo to the first instance of FOO. Of course the instance should be safe from garbage collection. The reason I want this is so that when I define a class where all instances will be the same in any execution (a command line parser for example) I only need one class. At present I need two: one to parse the command line and one to have a "once" function. Paul. Paul Johnson UUCP: !mcvax!ukc!gec-mrc!paj --------------------------------!-------------------------|------------------- GEC-Marconi Research is not | Telex: 995016 GECRES G | Tel: +44 245 73331 responsible for my opinions. | Inet: paj@uk.co.gec-mrc | Fax: +44 245 75244