<br><br><div class="gmail_quote">On Sun, May 30, 2010 at 15:38, Adam Ruppe <span dir="ltr">&lt;<a href="mailto:destructionator@gmail.com">destructionator@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 5/30/10, Brad Roberts &lt;<a href="mailto:braddr@puremagic.com">braddr@puremagic.com</a>&gt; wrote:<br>
&gt; I&#39;m all for removal of static opCall, and possibly opCall altogether.<br>
<br>
</div>Removing static opCall is definitely a good plan, but I&#39;d like to keep<br>
opCall. The reason is so you can make a Variant that holds a delegate,<br>
and is callable directly.<br></blockquote><div> </div><div><br>Even more generally, anytime you want a callable struct (well, doh!), to manage some complex state.<br>Sometimes, closures don&#39;t cut it. <br><br>For example, I like that in Clojure all data structures are functions of their elements, returning true if the element is already present. Handy to filter. In D, you can wrap a struct around an associative array and define opCall(E elem) to test if (elem in aa).<br>
Then, you can do:<br><br>auto a = filter!( [test for some elements]) (range);<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I tried implementing this a while ago, but it didn&#39;t work very well<br>
because sometimes the compiler would call the static opCall instead of<br>
the one I wanted! Keeping it around, but only for the one task, would<br>
be nice to me.<br></blockquote><div><br>I also had troubles with struct with an opCall and a this and couldn&#39;t explain to the compiler what I wanted. I had to use an .initialize() method to create the struct, to keep () for opCall.<br>
<br></div></div>