Login  Register

Re: I need some tips about Coercion

Posted by Piter Dias-4 on Sep 15, 2009; 11:42am
URL: http://quantlib.414.s1.nabble.com/I-need-some-tips-about-Coercion-tp12907p12909.html


> what would you coerce it to?

I would like to enhance the qlFixedRateBond Excel function in order to
model some Brazilian bonds but I was just able in two ways that is not
backward compatible:

1) Creating two new fields (Compounding and Frequency) but it would break
current spreadsheets because the automatic code generation makes the fields
Permanent and Trigger always as the last ones. So my new fields would be
created between the IssueDate and Permanent fields,
2) Change the coupons vector from QuantLib:Rates to
QuantLib::InterestRate. It breaks backward compatibility because,
currently, it just accepts a handle created by qlInterestRate. When I send
a Rate it crashes.

A third way is create a new Excel function, the way I am doing the test,
but the second way seems to be much better. Eric told that Coercion would
help me on this (so I can use to convert QuantLib:Rates to
QuantLib::InterestRate) but I am not sure if I got all the steps to make
it.

> it escapes me how you could make it backward compatible; I might
> suggest to just add another signature if needed.

I believe it won't work for Excel because it only accepts two functions
with different names, doesn't matter if the signature is different.

May you help me?

Regards,

-------------------------

Piter Dias
[hidden email]

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev