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 16:03:28 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: heilig@iname.com (Brian_Heilig) Newsgroups: comp.lang.c++,comp.lang.ada,comp.lang.eiffel,comp.object Subject: Re: OOP Language for OS Development Date: 23 Apr 2004 16:03:22 -0700 Organization: http://groups.google.com Message-ID: References: <95db0572.0404142153.431fd058@posting.google.com> <566e2bfb.0404181753.2844342f@posting.google.com> <4088D574.2020503@tele2.fr> <1082738747.300309@master.nyc.kbcfp.com> NNTP-Posting-Host: 63.109.236.83 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1082761403 9649 127.0.0.1 (23 Apr 2004 23:03:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 23 Apr 2004 23:03:23 +0000 (UTC) Xref: archiver1.google.com comp.lang.c++:31347 comp.lang.ada:7439 comp.lang.eiffel:732 comp.object:11066 Date: 2004-04-23T16:03:22-07:00 List-Id: Hyman Rosen wrote in message news:<1082738747.300309@master.nyc.kbcfp.com>... > Georg Bauhaus wrote: > > How would you write "once" routines in C++? > > With a static method containing a static value, of course. > > class UponATime > { > static double Once(/* args */) > { > static double value = /* some calculation */; > return value; > } > }; You are nowhere near the expressivity of once routines: 1. The body of `Once' will be executed with each call except for the stuff after the static declaration. In other words, you must put all of your calculation behind the equal sign! 2. You still need once per thread, once per object, and manual once functions. > It appears from my looking up what once functions do, > that arguments to the call are irrelevant for determining > whether it should be re-executed. If so, that's another > example of a hideous language design choice made by Eiffel. This is of course a consequence of your misunderstanding of once functions. > > How about the fine grained visibility control (where each feature > > can be made visible to only a specified set of types)? > > Speaking of hideous design decisions. This whole concept > of classes having fine-grained dictatorial control over > whom they allow access to their innards is more than a > little silly. You're funny. > template > struct C > { > T foo(T x); > virtual T bar(T x) = 0; > }; You missed the constrained generic parameter. G -> T means that G is the generic type and it must conform to T. I don't think C++ templates can emulate constrained generics yet, but I could be wrong. C++ will never reach the expressive power of Eiffel, but then again, you can't make an Eiffel compiler solve factorials, so maybe you win? Brian