5.2.1 New definitions of the time classes
We define the new class <time>:
define class <time> (<object>)
slot total-seconds :: <integer>, init-keyword: total-seconds:;
end class <time>;
We redefine <time-of-day> and <time-offset> to inherit from <time>:
// A specific time of day from 00:00 (midnight) to before 24:00 (tomorrow)
define class <time-of-day> (<time>)
end class <time-of-day>;
// A relative time between -24:00 and +24:00
define class <time-offset> (<time>)
end class <time-offset>;
Dynamic feature — no need to recompile: In C++, a complete recompile of the program would be necessary to change the superclass of a class. Most Dylan development environments support a mode that requires only that you compile the new class definitions. The difference between compiling only a few class definitions and compiling the whole program can be a time saver for complex applications.
|
N Feinberg/S E Keene/R Mathews/P Tucker Withington, DYLAN PROGRAMMING, (c) 1997 Harlequin Inc. Reproduced by permission of Addison-Wesley Longman Publishing Company, Inc. All rights reserved. No further copying, downloading or transmitting of this material is allowed without the prior written permission of the publisher.