Re: SDL-News: time conversion


Subject: Re: SDL-News: time conversion
From: Rick Reed TSE (rickreed#tseng.co.uk)
Date: Sun Dec 17 2000 - 12:55:20 GMT


Become an SDL Forum Society member <http://www.sdl-forum.org/Society/members.htm>
The originator of this message is responsible for its content.
-----From Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews -----

Thomas Weigert at thomas.weigert#motorola.com wrote on 16/12/2000 19:13:

> I understand the value of type checking. However, it is not clear to me how
> much value type checking adds in this particular case---it seems reasonable
> to add two Reals (one representing a time, the other a duration) to obtain a
> new time. In practice these are Integers or Reals anyway (in the code
> generator) and usually one interacts with external functions when it comes
> to time (either stored in PDUs, or part of calls to middle ware). So one
> usually ends up doing conversions between time or duration as represented
> externally as Integers or Reals, and time and duration as represented in
> SDL. Seems that this may be situation where the type checking is more often
> in the way than it helps?

Time and Duration have been distinct data types since 1984, and this is the
first occasion (that I can remember) that it has been suggested that they
are treated as syntypes of Real.

It is already the case that Real values can be added to Duration and Time
and used to multiply Durations (multiplication of time values does not make
logical sense).

New operations or procedures (user, application, or organisation defined)
can easily be added in a tool independent way to the existing Duration and
Time values to convert from Integer or Real to Duration or Time. At present
it is not possible to add operations or procedures in a tool independent way
to convert from Time and Duration to Real or Integer. If an operator that
converts a Duration to a Real is added this would be possible.

With respect to conversion between the SDL model of Time and that
implemented by the underlying system, it is obvious (at least to me) that
such conversions are going to be system dependent, so that treating time as
a syntype of Real would NOT be a universal solution. I would imagine that
for each different underlying system, a custom package is defined that
interfaces with SDL Time. It seems to me this would STILL be the case if
Time is treated as a syntype of Real, so there seems to be no advantage
(only disadvantage due to loss of type checking) in changing the language.

So my view is that adding custom operations or procedures is the way to
interact with the external functions so that that the type checking of SDL
does not get in the way. However, to do the this in the most implementation
independent way requires adding one operation to Duration:

Float (Duration) -> Real;

--
Rick Reed - rickreed#tseng.co.uk
Tel:+44 1455 55 96 55 Fax:+44 1455 55 96 58 Mob.:+44 7970 50 96 50

--End text from Rick Reed TSE <rickreed#tseng.co.uk> to sdlnews --- For extra SDL Forum Society benefits join at <http://www.sdl-forum.org/Society/members.htm>



This archive was generated by hypermail 2a23 : Thu May 09 2013 - 16:05:49 GMT