<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, May 5, 2013 at 6:44 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
C++ has tried this tack for some time. </blockquote><div><br></div><div>Sounds like it has failed then.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I can see doing for built-ins but how would you go about programmer-created operations? Trust the programmer? -- Matthias<br>
</blockquote><div><br></div><div>Well, I guess some checks can be added, but I don't see the difference between attaching bad properties to a newly created operator and defining a buggy procedure.<br><br></div><div>Laurent<br>
</div><div><br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
On May 5, 2013, at 11:00 AM, Laurent wrote:<br>
<br>
> Speaking of invariants, from time to time I would like Racket to know some properties about its usual operators, so that some usual treatments get simplified and can be easily generalized.<br>
><br>
> For example, considering group theory, properties like 'identity-element', 'absorbing-elements', 'inverse-operator', 'commutative?', 'associative?' and such could be attached to operators like `+', `*', `max', `string-append', `hc-append', etc.<br>
> Forms like `for/op' could use this information to know how to loop and accumulate, and even possibly to optimize the code, even for newly created operators.<br>
> In the simple case of + and such, one also only needs to define the binary operator, and the multi-argument procedure can be generated automatically.<br>
><br>
> Of course it needs not be tied to group/category/mathematical theory. It can be about whatever is useful.<br>
><br>
> It's only an idea, in case this resonates for someone.<br>
><br>
> Laurent<br>
</div></div>> _________________________<br>
> Racket Developers list:<br>
> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
<br>
</blockquote></div><br></div></div>