Ary Borenszweig wrote:
Trass3r wrote:
Ary Borenszweig schrieb:
I think this point is pretty feasible. I can probably implement it as a view. The only "problem" is that if I do that, I'll also have to show the optimized version of the code (which might be very interesting). So if you have:

Hey good idea, would be interesting to see what stuff gets optimized, inlined and stuff! :)

Well, now I'm not sure about this... I've just played around with this. If you give DMD's front end this:

---
module main;

class Foo {
}

int main(char[][] args) {
    scope(exit) { char[] x = "exit"; }
    scope(failure) { char[] x = "failure"; }
    scope(success) { char[] x = "success"; }
    Foo foo = new Foo();
    return 0;
}
---

it transforms it to this:

---
module main;
import object;
class Foo : Object {
}
int main(char[][] args) {
    try {
        try {
            int __osf15 = 0;
            try
                try {
                    Foo foo = new Foo;
                    return 0;
                } catch(Object __o2) {
                    __osf15 = 1;
                    throw __o2;
                }
            finally
                if(!__osf15)
                    char[] x = "success";
        } catch(Object __o1) {
            char[] x = "failure";
            throw __o1;
        }
    } finally
        char[] x = "exit";
}
---

I'm not sure you want to see that, heh. I think I'll stick with the "hover over a symbol to see it's compile-time representation" solution...

That doesn't look entirely useless, especially for optimization. Perhaps hard to read, but easier than reading the assembly output ;-P!

Reply via email to