<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>Hi,<BR>
&nbsp;<BR>
We have a mail merge engine. We wish to have the option of blessing mail merge fields (say &lt;##FirstName##&gt;) with the ability to do string formatting, such as proper casing, all caps, date formatting, and such. And the idea is while the mail merge engine is compiled C# code, we are hoping to leverage the dynamic nature of ironpython to allow business analysts and other staff to bless these mail merge fields with dynamic behaviors at a later date--through scripting. We imagine the signature of such a "filter" would go something like:<BR>
&nbsp;<BR>
protected string Filter_SomeBase32GibberishThatsSafeAlphaNumeric(string <FONT>dirtyText, Xml filterContext</FONT>)<BR>
{<BR>
&nbsp;&nbsp;&nbsp; string <FONT>cleanText = ""</FONT>;<BR>
&nbsp;<BR>
&nbsp;&nbsp;&nbsp; try {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // the dynamic part that do something with <FONT>cleanText, given additional information provided by filterContext xml dom</FONT><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // as an aside, this source code is checked into the db in raw source code form, until the time it need be used<BR>
&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp; finally<BR>
&nbsp;&nbsp;&nbsp; {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return cleanText;<BR>
&nbsp;&nbsp;&nbsp; }<BR>
}<BR>
&nbsp;<BR>
So far what I have learned is that I can do this in C#, using something like this example:<BR>
&nbsp;<BR>
<A href="http://www.codeproject.com/dotnet/evaluator.asp?df=100&amp;forumid=13971&amp;exp=0&amp;fr=26&amp;select=394822">http://www.codeproject.com/dotnet/evaluator.asp?df=100&amp;forumid=13971&amp;exp=0&amp;fr=26&amp;select=394822</A><BR>
&nbsp;<BR>
But we want a ton of performance out of this merge intelligence. We hope whatever was compiled (bytecode), is kepted in a hash tree so that recompilation is not a tax levied on each invocation. There will be many such functions, and we need to invoke it by reference/delegate (storing them in a lookup table).<BR>
&nbsp;<BR>
If we are really really greedy, we would make further requests like it be possible to update a function. To recompile an updated source code to one such instance and call the new updated bytecode.<BR>
&nbsp;<BR>
I have no experience with IronPython in terms of embedding it, and making use of it in such a scenario, and wish to consult the list for any suggestions or feasibility comments you may have. Thank you for your time and big kudos ahead of time for any participation on this.<BR>
&nbsp;<BR>
Best regards,<BR>
-- Li-fan chen<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR><br /><hr />Be one of the first to try  <a href='http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d' target='_new'>Windows Live Mail.</a></body>
</html>