<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>I'm not against introducing variant values into mondrian, 
but the impact of this change might be insidious, because we're blowing a hole 
in the strong typing system. Once a variant is introduced, it needs to work 
correctly in any expression.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>Consider these examples:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>1. </FONT></SPAN><SPAN class=920412201-12042007><FONT 
face=Verdana color=#000080 size=2>Iif(1 = 1, 2, 3) + 4</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>2. </FONT></SPAN><SPAN class=920412201-12042007><FONT 
face=Verdana color=#000080 size=2>Iif(1 = 1, "Foo", 3) + 4</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>In each case, what do you expect to happen, and what 
actually happens?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>#1 currently type-checks as an integer expression, but 
after your change it will be &lt;variant&gt; + &lt;int&gt;, and I'm not sure how 
that gets type-checked or evaluated.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>#2 currently gives a compile-time exception, which can be 
fixed using casts:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>Iif(1 = 1, "Foo", Cast(3 as string)) + Cast(4 as 
string)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>So, a simpler solution might be to fix the type 
inference/validation of the Iif function. Require the arguments to be of the 
same type (using 'cast' if necessary), make sure that we give a useful error 
message if the arguments are of incompatible types, and make Iif return the same 
type as its 2nd and 3rd arguments.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>Note that everything which applies to Iif probably applies 
to CASE also.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>Julian</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=920412201-12042007><FONT face=Verdana 
color=#000080 size=2>PS Please send future emails to the mondrian dev list 
unless they contain proprietary/sensitive material.</FONT></SPAN></DIV><FONT 
face=Verdana color=#000080 size=2></FONT><FONT face=Verdana color=#000080 
size=2></FONT><FONT face=Verdana color=#000080 size=2></FONT><FONT face=Verdana 
color=#000080 size=2></FONT><FONT face=Verdana color=#000080 size=2></FONT><FONT 
face=Verdana color=#000080 size=2></FONT><BR>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000080 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> Thiyagu Palanisamy 
  [mailto:tpalanis@thoughtworks.com] <BR><B>Sent:</B> Tuesday, April 10, 2007 
  6:39 AM<BR><B>To:</B> julianhyde@speakeasy.net<BR><B>Cc:</B> 
  Matthew.Campbell@thomson.com; Ajit Vasudeo Joglekar; 
  RenoMondrian@thoughtworks.com<BR><B>Subject:</B> Generic IIF implementation 
  for your review<BR></FONT><BR></DIV>
  <DIV></DIV><BR><FONT face=sans-serif size=2>Hi Julian,</FONT> <BR><BR><FONT 
  face=sans-serif size=2>We have come up with a solution to make IIf MDX 
  function to take (boolean, variant, variant) and return a (variant) similar to 
  MSAS so as to avoid all permutations and combinations of parameter types and 
  different return types decided at run time.</FONT> <BR><BR><FONT 
  face=sans-serif size=2>We realized that currently there is no support for 
  BasicType or AnyType or VariantType that we can readily use. We were looking 
  for late binding support rather than the current early binding (compilation) 
  that takes place. &nbsp;We initially thought of a base class to all the 
  specific Type classes but realized that there could be substantial changes and 
  still no guarantee of making it work. Then we thought of adding just another 
  Type (VariantType) and providing special handling for it where ever 
  required.</FONT> <BR><BR><FONT face=sans-serif size=2>We have been able to 
  successfully run all tests with this generic IIf.</FONT> <BR><BR><FONT 
  face=sans-serif size=2>We have attached the zip file containing all the 
  modified files. Files are based on revision no : 9071 &nbsp;(Couldn't get 
  packChange to work in our machine)</FONT> <BR><BR><FONT face=sans-serif 
  size=2>Extracting the attached archive in /home/open will copy and replace the 
  modified files.</FONT> <BR><BR><BR><BR><BR><FONT face=sans-serif size=2>We 
  have not checked in into perforce because of few fundamental changes that we 
  feel should be reviewed first. Could you please review this?</FONT> 
  <BR><BR><FONT face=sans-serif size=2>Thanks &amp; Regards,</FONT> <BR><FONT 
  face=sans-serif size=2>Ajit &amp;Thiyagu - Pairing</FONT> 
<BR></BLOCKQUOTE></BODY></HTML>