From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,e0a59694a441eb7b X-Google-Thread: 103376,e0a59694a441eb7b X-Google-Thread: fac41,e0a59694a441eb7b X-Google-Thread: 1108a1,e0a59694a441eb7b X-Google-Attributes: gid109fba,gid103376,gidfac41,gid1108a1,public X-Google-ArrivalTime: 2004-04-23 14:19:42 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.octanews.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Fri, 23 Apr 2004 17:18:56 -0400 From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.c++,comp.lang.ada,comp.lang.eiffel,comp.object Subject: Re: OOP Language for OS Development References: <95db0572.0404142153.431fd058@posting.google.com> <566e2bfb.0404181753.2844342f@posting.google.com> <4088D574.2020503@tele2.fr> <1082738747.300309@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1082755136.352016@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1082755136 28673 204.253.250.10 Xref: archiver1.google.com comp.lang.c++:31332 comp.lang.ada:7434 comp.lang.eiffel:729 comp.object:11060 Date: 2004-04-23T17:18:56-04:00 List-Id: Georg Bauhaus wrote: > So in the general case where the method will have (side) > effects on object variables I use an if (once) {...} with a > static bool once, I guess? What do you mean? A static variable in a function is initialized the first time control passes through the declarartion, and never again. So my code is equivalent to your ONCE method - the first time the function is called, the variable will be initialized, so you can plant all of the code you want to execute once as part of that initialization. After that, no matter how many times you call the function, the initialization code won't be executed. > Whatever suggests the necessity of ONCE in a language, if it is > necessary then being able to write ONCE might have an advantage > in my view. *Shrug* I'm not thrilled with a language feature which allows the compiler to replace a call to f(2) with an earlier call to f(1), but maybe that's just me. Ada allows you to decorate a function with Pragma Pure, and then it can elide multiple calls to a function if it is called with the same parameters (regardless of whether the function has side effects). > So the compiler, compiling seperately, will not know which types > can be passed to some_C.foo before the linker is run. In C++, there is no some_C.foo. There is a some_C.foo for each type T that some_C is instantiated with. Each one is a logically separate function, and they have nothing to do with each other.