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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38159b1b5557a2e7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-24 04:56:02 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread3.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail Message-ID: <40126B5E.8050205@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Standard Ada Preprocessor (Was: why ada is so unpopular ?) References: <49cbf610.0401170627.79c3dfe5@posting.google.com> <400A9B48.3060100@noplace.com> <400BD4B5.6000307@noplace.com> <400BDB7C.40100@noplace.com> <400D2150.6000705@noplace.com> <400E72F9.8060501@noplace.com> <100upo7ln5e3k59@corp.supernews.com> <401118FD.701@noplace.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 24 Jan 2004 12:56:01 GMT NNTP-Posting-Host: 209.165.23.2 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.atl.earthlink.net 1074948961 209.165.23.2 (Sat, 24 Jan 2004 04:56:01 PST) NNTP-Posting-Date: Sat, 24 Jan 2004 04:56:01 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:4768 Date: 2004-01-24T12:56:01+00:00 List-Id: That works for some things, but it still will barf when a statement is compileable for one target but not for another. I'm thinking of a case where (for example) you can get one size of float for one target, but for another target that size is not allowed. Hiding it in a discriminated record isn't going to help if the compiler pukes all over the alternative you're not going to use. Perhaps the compiler should be smarter - but if I keep waiting for compilers to be smarter, I won't get my job done & I'll be forced to resort to C. ;-) If you don't like the floating point example ("You ought to be using digits & attributes, you fool!" :-) then think "representation clause" and start imagining all the target/compiler variations on that. Its an interesting proposition and might provide some usefulness. Certainly there are characteristics that can be toggled at runtime and this might be of some help. (Like I said, the runtime stuff I already could have handled with my own package.) Its just that usually the point where I get hung out to dry is when I can't get something past the compiler because it is compiler-dependent or there's something platform/target dependent that makes the compiler choke. MDC Robert I. Eachus wrote: > > Today you can write code that says: > > if Configuration.OS = "TOPS 10" > then > > else > > end if; > > And your compiler should eliminate the code not executed if > Configuration.OS is a static string constant. That is available now. > > What about declarations? Then you have two choices. The first is > variant parts: > > type Foo(Choice: Boolean) is record > case Choice is > when True => > Tops_10_Component: Float; > when False => > ... > end case; > end record; > > Or you can do: > > if Configuration.OS = "TOPS 10" > then > declare > Tops_10_Only: Integer := ...; > begin > > end; > else > declare > Some_Other_Declaration: Some_Record_Type; > begin > > end; > end if; > > Also you can make a static Boolean constant: > > Tops_10: constant Boolean := Configuration.OS = TOPS 10"; > > If you want or need to, I usually do. Oh, one other neat trick. Look > at Foo above. When creating all those objects of type Foo, you don't > want to have to remember to specify the correct constraint. So just say: > > subtype Foob is Foo(Tops_10); > > If you forget and declare an object of type Foo, the compiler will tell > you. (Unless of course you give it an initial value, but then you don't > really have a bug anyway, since the value has the right discriminant.) > > If you are generating decent floating point code for x86 processors > right now you can end up with a LARGE enumeration type and case > statements. (Actually, combining the cases so the right one is available > on each system is a non-trivial exercise. And once I get it working, I > often leave the intended static constants as variables and set them at > install-time or run-time. I need that to make testing survivable, so > why not let people use it that way. ;-) > > So right now, these features are a usable part of the language. Not > heavily used, but they can be. Which is why I think that "fixing" > System and explaining why would be a big help. > > > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Face it ladies, its not the dress that makes you look fat. Its the FAT that makes you look fat." -- Al Bundy ======================================================================