OT (partially): about promotion of integers

Araq rumpf_a at gmx.de
Wed Dec 12 02:04:37 PST 2012


> I implement, say, a Matrix class, then I should be able to tell 
> the
> compiler that certain Matrix expressions, say A*B+A*C, can be 
> factored
> into A*(B+C), and have the optimizer automatically do this for 
> me based
> on what is defined in the type. Or specify that 
> write("a");writeln("b");
> can be replaced by writeln("ab");. But I haven't come up with a 
> good
> generic framework for actually making this implementable yet.

Yeah, it's not that easy; Nimrod uses a hygienic macro system 
with term rewriting rules and side effect analysis and alias 
analysis for that ;-).

http://build.nimrod-code.org/docs/trmacros.html

http://forum.nimrod-code.org/t/70



More information about the Digitalmars-d mailing list