comp.lang.ada
 help / color / mirror / Atom feed
From: kst@thomsoft.com (Keith Thompson)
Subject: Re: Software Engineering News Brief
Date: 1996/11/19
Date: 1996-11-19T00:00:00+00:00	[thread overview]
Message-ID: <E14vL8.8nw@thomsoft.com> (raw)
In-Reply-To: 56q5e3$ntv@gaia.ns.utk.edu


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




  parent reply	other threads:[~1996-11-19  0:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-05  0:00 Software Engineering News Brief tmoran
1996-11-05  0:00 ` Robert Dewar
1996-11-07  0:00   ` Stefan.Landherr
1996-11-11  0:00     ` Robert Dewar
1996-11-05  0:00 ` jimgregg
1996-11-06  0:00 ` Tom Reid
1996-11-07  0:00   ` Norman H. Cohen
1996-11-07  0:00   ` Robert Dewar
1996-11-08  0:00   ` Robert I. Eachus
1996-11-09  0:00     ` Paul Eggert
1996-11-11  0:00       ` Norman H. Cohen
1996-11-16  0:00       ` Robert Dewar
1996-11-17  0:00         ` Fergus Henderson
1996-11-17  0:00           ` Robert Dewar
1996-11-17  0:00             ` Larry J. Elmore
1996-11-17  0:00               ` Robert Dewar
1996-11-18  0:00                 ` Keith Thompson
1996-11-18  0:00               ` Norman H. Cohen
1996-11-19  0:00                 ` Frank Manning
1996-11-18  0:00               ` Larry Kilgallen
1996-11-18  0:00                 ` Robert Rodgers
1996-11-18  0:00             ` Mark A Biggar
1996-11-18  0:00             ` Dave Sparks
1996-11-24  0:00             ` Paul Eggert
1996-11-24  0:00               ` Robert Dewar
1996-11-25  0:00                 ` Paul Eggert
1996-11-18  0:00         ` Matt Kennel
1996-11-19  0:00           ` Martin Tom Brown
1996-11-19  0:00           ` Keith Thompson [this message]
1996-11-21  0:00   ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
1996-11-12  0:00 Marin David Condic, 561.796.8997, M/S 731-93
1996-11-09  0:00 tmoran
1996-11-09  0:00 ` Robert Dewar
     [not found] <55t882$9m@news2.delphi.com>
1996-11-07  0:00 ` Robert Dewar
1996-11-07  0:00 tmoran
1996-11-07  0:00 ` Robert Dewar
1996-11-01  0:00 Software Engineering News
1996-11-01  0:00 ` Adam Beneschan
1996-11-05  0:00 ` David Bradley
1996-11-05  0:00   ` Larry Kilgallen
1996-11-05  0:00     ` Steve Jones - JON
1996-11-06  0:00   ` Ed Falis
1996-11-06  0:00 ` John Cosby
     [not found] ` <55rmsc$2ee$1@shade.twinsun.com>
1996-11-07  0:00   ` caip.rutgers.edu!halasz
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox