Login  Register

Re: Any rationale that currency codes and calendars are hard coded at compile time rather than read from a text file at runtime?

Posted by Luigi Ballabio on Oct 03, 2011; 12:51pm
URL: http://quantlib.414.s1.nabble.com/Any-rationale-that-currency-codes-and-calendars-are-hard-coded-at-compile-time-rather-than-read-from-tp9114p9117.html

On Mon, 2011-10-03 at 20:14 +0800, R Y wrote:
> Your points are perfectly valid. My point is that reading from a text
> file improves the extendibility of the library as it doesn't require
> rebuilding the source code (of course I'm sure you're well aware of
> that).

Yes, and you can do it already.  Read a list of dates in whatever way
you like, build a BespokeCalendar instance, pass it the dates you read,
it's done.  In case a new holiday is added to an existing calendar, you
can use the addHoliday method instead of modifying the code.  So you
have extendibility.

In the context of a library, data files are somewhat prone to problems.
For instance, how should the library know where the data files are?  On
windows, you might have a preferred location for those.  On Linux
systems, there are a number of preferred locations which are used
depending on whether one installs the library as user or superuser.
Then the library might be linked statically to one's program, which
means that suddenly a developer using the library has to ship the
calendar files together with his program.  The added migraines just
don't seem worth the effort...

Luigi


--

When I was a boy of fourteen, my father was so ignorant I could hardly
stand to have the old man around. But when I got to be twenty-one, I
was astonished at how much the old man had learned in seven years.
-- Mark Twain



------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev