Jonathan S. Shapiro wrote: >> Judicious use of operators with customizable precedence can greatly >> *improve* the clarity of code, as much as it can harm it. > > Examples please, not assertions. Specifically: examples where we cannot > solve the problem by pre-introducing a limited number of operators > having language-specified associativity and precedence.
Combinator libraries are prevalent in functional languages. Consider a combinator library for concurrency ala Orc orchestration language. Nesting 'par' and 'seq' is a real pain. I know, because I wrote on Orc combinator library in C# [2] which can't benefit from infix operators. C# has the fixed set of operators you suggest, and they're completely useless. Or consider having to multiply nest 'seq' for strongly typed printf without an infix ^ [1]. Or parser combinators, or ... I think many combinator libraries could benefit from a judicious choice of infix operators. >> As for code analysis, I consider that a standard library deficiency. Why >> isn't the language's parser available in its own standard library? > > How would that help the code reviewer who is attempting to review the > program that has been printed on a piece of paper? So a facility is broken because it doesn't help 0.001% of the market reviewing code on paper? I don't find that convincing. I understand the barrier to code review that customizable precedence provides, which is why I've generally been against it, but I don't deny that it's a powerful tool. Pencil and paper arguments in this day and age aren't convincing, where powerful toolsets are prevalent. If Java can actually be made pleasant to program in given it's powerful toolset (which many do believe), then imagine how much easier auditing can be given proper tools. Also, in ML you can just rebind infix symbols in your source file to whatever precedence level you like. If you're really all that concerned about it (ie. for paper review), enforce such a rebindings for every file using operators, or define the rebindings for a whole project using a global include. Sandro [1] http://citeseer.ist.psu.edu/danvy98functional.html [2] http://sourceforge.net/projects/Orc-dotnet _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
