<div dir="ltr"><div><div>Thanks.<br><br></div>Taken on board and fixes pushed.<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


I would love away around that.<br>
</blockquote>
<br>
<a href="http://dlang.org/phobos/std_exception.html" target="_blank">http://dlang.org/phobos/std_exception.html</a><br></blockquote>
<br></div>Tried using assertThown!AssertError but @safe still, umm, throws that out.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 24, 2013 at 3:22 PM, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">John Carter:<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm storing the roman numerals as dchars. I have the vague hope this is more efficient than storing them as strings.<br>
</blockquote>
<br></div>
From/to Roman numbers conversions are never performance-critical. It looks like premature optimization.<div class="im"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What do you mean by "missing UCSF"?<br>
</blockquote>
<br></div>
Sorry, it's UFCS (Universal Function Call Syntax), it means writing x.foo instead of foo(x).<div class="im"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I would love away around that.<br>
</blockquote>
<br>
</div><a href="http://dlang.org/phobos/std_exception.html" target="_blank">http://dlang.org/phobos/std_<u></u>exception.html</a><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


That's quite bad code. Better:<br>
<br>
    return roman.map!romanToDigit.array;<br>
<br>
<br>
</blockquote></div><div class="im">
That certainly looks nicer, alas, dmd is unhappy....<br>
</div></blockquote>
<br>
When you have only one argument the () is not needed:<br>
<br>
return roman.map!(a => romanToDigit(a)).array;<br>
<br>
The cause of your error: romanToDigit is module-private. If you make romanToDigit public the error goes away. If you use a lambda the problem also goes away for different reasons. So in this case using a lambda is OK.<div class="im">

<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I thought it meant just putting a ddoc /// extra / flag on the comment,<br>
</blockquote>
<br></div>
Right. The Ddoc-produced html should show the unittest.<br>
<br>
You can also add a module-level ddoc to your module.<br>
<br>
<br>
return find!((a,b) =><br>
<br>
In most cases it's better to put a space after every comma ==><br>
<br>
return find!((a, b) =><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
};<br>
</blockquote>
<br>
In D don't put a ; there for struct/classes/unions.<br>
<br>
I think the code density of the toRomansWithZero() function is too much low. I suggest to pack it vertically a little more. D is not C#.<br>
<br>
<br>
O suggest you to be more careful with size_t, your code doesn't compile on a 32 bit system:<br>
<br>
test.d(59): Error: cannot implicitly convert expression (this.regionIndex) of type const(ulong) to uint<br>
test.d(62): Error: cannot implicitly convert expression (this.regionIndex) of type const(ulong) to uint<br>
test.d(62): Error: cannot implicitly convert expression (this.regionIndex) of type const(ulong) to uint<br>
test.d(66): Error: cannot implicitly convert expression (this.previous) of type const(ulong) to uint<br>
<br>
<br>
So this could be better:<br>
<br>
   size_t regionIndex; /// Some digits in the system "dominate" over others.<br>
   size_t previous;    /// Hardcode link to previous digit.<br>
<br>
<br>
I also suggest to add an ending "." to comments.<br>
<br>
With this I think the surface review of your code is mostly done.<br>
<br>
Bye,<br>
bearophile<br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">John Carter<br>Phone : (64)(3) 358 6639<br>Tait Electronics                         <br>PO Box 1645 Christchurch<br>New Zealand<br><br></div>
</div>

<br>
<hr><font color="#808080">This email, including any attachments, is only
 for the intended recipient. It is subject to copyright, is confidential
 and may be the subject of legal or other privilege, none of which is 
waived or lost by reason of this transmission.</font><div><font color="#808080">If
 you are not an intended recipient, you may not use, disseminate, 
distribute or reproduce such email, any attachments, or any part 
thereof. If you have received a message in error, please notify the 
sender immediately and erase all copies of the message and any 
attachments.</font></div><div><font color="#808080">Unfortunately, we 
cannot warrant that the email has not been altered or corrupted during 
transmission nor can we guarantee that any email or any attachments are 
free from computer viruses or other conditions which may damage or 
interfere with recipient data, hardware or software. The recipient 
relies upon its own procedures and assumes all risk of use and of 
opening any attachments.</font></div><div><hr></div>