[Seaside] [VW] Seaside/VW Support - Time & Date Classes
Michel Bany
m.bany at wanadoo.fr
Sat Feb 12 10:43:44 CET 2005
> Michel,
> I was wondering if there is a reason that there are two Date and Time
> classes in the VW port? As far as I can tell, there is no additional
> behavior. The classes are Squeak.Date, Seaside.Date and Squeak.Time &
> Seaside.Time. It seems this also applies to the class Color.
>
Yes Brett, there is a reason. Here are the details, sorry for being long.
A large amount of the port work consists in making VisualWorks look like
Squeak for Seaside.
For this purpose, we need to add conveniency methods to the base
VisualWorks library
and also a bunch of new classes to implement some of the Squeak API. At
some point in time
I got the idea to extract all of the "squeakisation" stuff and to create
a separate bundle. So I created
that bundle named "Squeak" where I collected the squeakisation items
needed for Seaside and,
while at it, I collected more squeakisation stuff from other sources. At
the same time, I was having
problems porting the cookies expiration logic, because Seaside relies on
the Squeak Chronology
framework for this. Also at the same time, there were discussions (on
the VWNC mailing list I believe)
regarding the availability of class DateAndTime in VisualWorks. So I
decided to port the Chronology
classes to VisualWorks and I created bundle "Squeak-Chronos". Bundles
"Squeak" and "Squeak-Chronos"
were designed independently of Seaside.
As can be expected bundle "Squeak-Chronos" has some classes that
conflict with the base VisualWorks
library, namely, Date, Time, and TimeZone (TimeStamp in Squeak does not
conflict with Timestamp).
Fortunately VisualWorks has namespaces that can handle that.
However, the Seaside namespace imports both the Squeak and the Smalltalk
namespace, therefore
references to these three class names are ambiguous. Since I did not
want to patch the Seaside
source code to replace all occurences of those ambiguous names by fully
qualified names, I used
a naughty trick to define classes Date, Time and TimeZone in the Seaside
namespace as subclasses
of Date, Time, TimeZone from the Squeak namespace, just to resolve the
ambiguity transparently
for Seaside. This also ensures that Seaside uses the Squeak
implementation of these three classes
making the Seaside port easier and quicker, since I do not have to care
about Date and Time
differences between Squeak and VW.
For the Color class, I used the same naughty trick, in a different
context. Seaside contains extensions
to the Color class. However the Color class does not exist in
VisualWorks but exists in the "Squeak"
bundle, defined in the Squeak namespace as a subclass of VW ColorValue.
When importing the
Seaside code into VisualWorks, the Color extensions (for some reason)
could not be assigned to
Squeak.Color, therefore I created Seaside.Color (subclass of
Squeak.Color) so that Seaside
extensions to Color could be loaded. Note that Seaside does not use the
Color any longer since
the Seaside-Contrib package was discontinued.
A final note. You may want to try if Seaside would work with the Date
and Time from the base
VisualWorks library. Just change the superclass of Seaside.Date and
Seaside.Time to be Core.Date
and Core.Time and see how it goes.
Enjoy,
Michel.
More information about the Seaside
mailing list