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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f43e6,37e6dbf5e31f6da0 X-Google-Attributes: gidf43e6,public X-Google-Thread: 103376,37e6dbf5e31f6da0 X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,37e6dbf5e31f6da0 X-Google-Attributes: gid10db24,public X-Google-Thread: 1108a1,37e6dbf5e31f6da0 X-Google-Attributes: gid1108a1,public X-Google-Thread: ff6c8,37e6dbf5e31f6da0 X-Google-Attributes: gidff6c8,public From: kst@thomsoft.com (Keith Thompson) Subject: Re: Software Engineering News Brief Date: 1996/11/19 Message-ID: #1/1 X-Deja-AN: 197512460 sender: news@thomsoft.com (USENET News Admin @flash) x-nntp-posting-host: pulsar references: <55nqea$32a@news2.delphi.com> <3280BAFA.1B2F@email.mot.com> <563tle$cu7$1@shade.twinsun.com> <56q5e3$ntv@gaia.ns.utk.edu> organization: Thomson Software Products, San Diego, CA, USA newsgroups: comp.lang.ada,comp.sw.components,comp.object,comp.software-eng,comp.edu originator: kst@pulsar Date: 1996-11-19T00:00:00+00:00 List-Id: In <56q5e3$ntv@gaia.ns.utk.edu> mbk@caffeine.engr.utk.edu (Matt Kennel) writes: [...] > Let's stop complaining about the problem and start thinking about its > fundamentals correctly. > > There are indeed universal and uniform notions of "date", for example, > counting absolute days, defined perhaps as count of maximum solar altitude > over some fixed longitude. [...] > Given this representation, the translation to MM/DD/YY is a *transformation > layer* (model vs. view) > depending on location, time, religion, nationality, et cetera. > > E.g. RussianAndSovietOrthodoxDateTranslator, WesternEuropeanDateTranslator, > FrenchRevolutionDateTranslator, RomanEmpireDateTranslator An Ada implementor could provide this kind of thing within the language. The type Ada.Calendar.Time is private. The full type could easily be declared to represent times over a much longer range than 1901..2099. It could even be a Julian Day Number (if it has sufficient precision). The Year, Month, Day, and Seconds functions, and the Split procedure, in package Calendar are required to raise Time_Error if their argument represents a date outside the range 1901..2099, but an implementation could provide child packages of Calendar implementing other "transformation layers". For example: package Ada.Calendar.Extended is subtype Year_Number is Integer range 1 .. 9999; procedure Split (Date : in Time; Year : out Year_Number; Month : out Month_Number; Day : out Day_Number; Seconds : out Day_Duration); -- We would also declare functions Year, Month, Day, Seconds, -- Time_Of, "+", "-", "<", "<=", ">", and ">=". end Ada.Calendar.Extended; Whether it really makes sense to extend the representation of type Time for this purpose is another question. The advantage of this approach is that it uses a single type, Ada.Calendar.Time, for multiple transformation layers. The disadvantage is that it can make existing operations on type Time less efficient, particularly the "delay until" statement that's built into the language. Note that a user, as opposed to an implementer, cannot extend the range of type Time, though of course you can declare whatever types you want in a user-defined package. -- Keith Thompson (The_Other_Keith) kst@thomsoft.com <*> TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products 10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706 FIJAGDWOL