Login  Register

Re: Calendars

Posted by Simon Ibbotson - Straumur on May 06, 2008; 5:05pm
URL: http://quantlib.414.s1.nabble.com/Calendars-tp6072p6078.html

If we defined something like
vector<Date> RigaHolidays;
vector<Date> GreenlandHolidays;

...

and we added a label to the holiday, so we can fulfil the member function ::name()

BespokeCalendar c1("Riga", RigaHolidays);
BespokeCalendar c2("Greenland", GreenlandHolidays);

c1 = c2;

Then c1 and c2 would both contain Greenland holidays, a label of "Greenland" and should link to the same holiday set - so they should retain their link.

If we have

c1 = c2;

and we don't retain the link, then the only reason for doing this is so we can easily copy a holiday set to instantiate another holiday set before making it slightly different.
I'd suggest that making the behaviour consistent across Calendar classes is more important.




-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: 06 May 2008 17:11
To: Simon Ibbotson - Straumur
Cc: Ferdinando Ametrano; a akpitidis; [hidden email]
Subject: RE: [Quantlib-users] Calendars


On Tue, 2008-05-06 at 14:08 +0000, Simon Ibbotson - Straumur wrote:
> I don't think it needs to have copy semantics. Calendars are usually
> static data so I wouldn't think that several versions of a calendar
> would be necessary/desirable.
>
> In other words, if we add a holiday to a given - specific - holiday
> calendar, that should propagate into all instances of that calendar.

Yes, this is the current behavior for all specific calendars (TARGET
etc.) (except for JointCalendar)

> I can't think of a reason you might want two differing versions of the
> same calendar (except for cases which could be resolved external to
> QuantLib - measuring the impact of adding a missing holiday, for
> example).

For a specific calendar, no reason. For bespoke calendars, things are
different. If we write

BespokeCalendar c1;
BespokeCalendar c2;

we should be able to give different holidays to c1 and c2---or we'd be
limited to just one bespoke calendar.  The question is, when we write

BespokeCalendar c1;
BespokeCalendar c2 = c1;

should c1 and c2 stay linked, so that modifications in one are
propagated to the other?

> This would have the advantage of preserving the current behaviour (and
> minimal code changes!).

Yes, you have a point here.

Luigi


--

I hate quotations.
-- Ralph Waldo Emerson


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users