[Mono-list] *Calendar implementation

Ulrich Kunitz gefm21@uumail.de
Wed, 20 Mar 2002 00:52:09 +0100


Hello,

thanks for all the responses.

Miguel de Icaza wrote:

> > I've implemented some classes missing in System.Globalization
> > (*Calendar) as my first C# code.
> 
> Wow.  Excellent!  

Thank a Microsoft .NET consultant here in Germany, who started his
presentation with an open Emacs editor. We worked together some years
ago. Never mind, he is great on UNIX too. So I had to look at C# and
the rest of the stuff. BTW last year I did some recreational astrocode
hacking, so I knew the literature about calendar implementation.

According to the .Net application the *Calendar classes belong to the
corlib. I've done that already.

I will resolve the namespace issue as you, Miguel, have recommended:
internal classes in System.Globalization.

Now I need some back reference:

> > The .net calendar classes are using registry entries (e.g. HKCU/Control
> > Panel/International/AddHijriDate) to set defaults. Currently I'm
> > providing defaults in the source code and added a new property for
> > AddHijriDate to control the value. Way to go?
> 
> At this point we do not have a registry.  I would suggest that you do
> either one of:
> 
> 	1. Use the registry calls from .NET and document as part of
> 	   the class libraries (and document them in a new file here:
> 	   mcs/class/docs/registry-keys with the information)
> 
> 	2. Abstract the call into a call that we can later abstract and
> 	   adapt to the particular options of fetching this information.
> 
> I like the later, but it requires a couple of extra calls. 

The second approach isn't good, because we introduce a registry wrapper,
just another class to understand and to maintain. I think we document
the shortcoming and add the registry calls, when a registry exists. We
should do some real architectural work here. I would even tend to say,
that the registry is not one of Microsoft greatest achievements in
software design. Let's try to do it a little better.

Maybe there is somewhere out there, who has running an arabic Windows
version. I would like to know, if you set AddHijriDate to 1 in the
Regional Settings/Options of the Control Panel, is today a day earlier
or a day later in the month? (e.g. first instead second day of the month
or third instead second day) German windows versions seem to ignore the
registry entry, so I've no idea how to interpret the sign of the value.
I can't find any usefull information beside the .NET documentation in
MSDN and Google.

> > It will take some time for me to provide the patch, because
> > documentation and NUnit work have also to be done.
> 
> Excellent!  I can open a CVS account for you, check:
> 
> 	http://www.go-mono.com/ccvs.html

Before that I've to do NUNIT tests, it's easy to get calendar
implementations wrong. (I've done some tests outside the Mono class
structure but not inside.)

Currently I get an TypeInitializationException in the static constructor
(.cctor) of DateTime with Mono corlib. It seems that the initialization
of static integer array, calling System.ArrayCopy, causes the exception.
I haven't looked deeper into the issue. Any ideas?

I do the tests still with the .NET framework not using Mono Compiler,
JIT, or interpreter and used the anonymous CVS for the source. The
corlib_reference.dll doesn't have the problem.

I could solve the issue by making changes to DateTime, because the
arrays are not needed.

Ciao,

Uli Kunitz

-- 
Ulrich Kunitz (gefm21@uumail.de)