digitalmars.D.learn - How to see result of a mixin? (equivalent of running C preprocessor)
- asd (2/2) Jul 24 2009 I'm trying to get D-ObjC bridge working and I'm getting weird errors tri...
- Ary Borenszweig (3/6) Jul 24 2009 You can debug templates and mixins using Descent:
- Ary Borenszweig (2/13) Jul 24 2009 I mean... http://dsource.org/projects/descent
- Lutger (9/15) Jul 24 2009 Not directly except with descent. It's worth it to try descent compile t...
- asd (8/19) Jul 24 2009 It's indeed pretty nice, but unfortunately it doesn't seem to show mixin...
- asd (2/5) Jul 24 2009 Solved! I've sprinkled the code with pragma(msg,"I'm not dead yet") and ...
- Ary Borenszweig (6/28) Jul 25 2009 Maybe because it can't instantiante the template. :-)
- Ary Borenszweig (2/33) Jul 25 2009 But now I see "D2". Still not supported by Descent, awww...
- Trass3r (2/3) Jul 26 2009 Unfortunately, yes :(
I'm trying to get D-ObjC bridge working and I'm getting weird errors triggered somewhere deeply in a mix of templates and mixins that's too hard for me to understand. How can I analyze such problem in D? Is it possible to tell dmd to run only compile-time functions/templates and output that as a D source?
Jul 24 2009
asd wrote:I'm trying to get D-ObjC bridge working and I'm getting weird errors triggered somewhere deeply in a mix of templates and mixins that's too hard for me to understand. How can I analyze such problem in D? Is it possible to tell dmd to run only compile-time functions/templates and output that as a D source?You can debug templates and mixins using Descent: http://dsource.org/project/descent
Jul 24 2009
Ary Borenszweig wrote:asd wrote:I mean... http://dsource.org/projects/descentI'm trying to get D-ObjC bridge working and I'm getting weird errors triggered somewhere deeply in a mix of templates and mixins that's too hard for me to understand. How can I analyze such problem in D? Is it possible to tell dmd to run only compile-time functions/templates and output that as a D source?You can debug templates and mixins using Descent: http://dsource.org/project/descent
Jul 24 2009
asd wrote:I'm trying to get D-ObjC bridge working and I'm getting weird errors triggered somewhere deeply in a mix of templates and mixins that's too hard for me to understand. How can I analyze such problem in D? Is it possible to tell dmd to run only compile-time functions/templates and output that as a D source?Not directly except with descent. It's worth it to try descent compile time debugger (and compile time view!), really awesome stuff. Other than that, you can use pragma(msg, ...) where you have several options for ... depending on what you want to debug and whether it's D1 or D2. .stringof property and typeof() are useful for this. Take a look at std.traits and for D2 at __traits. Generally the error messages with such code is not so friendly. String mixins can also just be printed with writeln / Stdout.
Jul 24 2009
thanks for quick response! Lutger Wrote:Not directly except with descent. It's worth it to try descent compile time debugger (and compile time view!), really awesome stuff.It's indeed pretty nice, but unfortunately it doesn't seem to show mixins:public void STARTS_HERE() {} mixin ObjcMethodInfo!(objcForward_isEqual_, BOOL, "isEqual:", id); public void ENDS_HERE(int h) {}is displayed in Descent's Compile-Time view as:void STARTS_HERE() { } void ENDS_HERE(int h) { }Error I'm trying to fix is: cocoa/foundation/object.d(74): Error: function cocoa.foundation.object.NSObject.ObjcMethodInfo!(objcForward_isEqual_,byte,"isEqual:",objc_ob ject*).ObjcSubclassIfNeeded!().ObjcSubclass!().ObjcSubclass!("NSObj ct"c).objcHardWired multiple overrides of same function My guess is that I need to make this mixin to insert override keyword when neccessary, but haven't figured out yet how.
Jul 24 2009
Error I'm trying to fix is: cocoa/foundation/object.d(74): Error: function cocoa.foundation.object.NSObject.ObjcMethodInfo!(objcForward_isEqual_,byte,"isEqual:",objc_ob ject*).ObjcSubclassIfNeeded!().ObjcSubclass!().ObjcSubclass!("NSObj ct"c).objcHardWired multiple overrides of same functionSolved! I've sprinkled the code with pragma(msg,"I'm not dead yet") and it led me to the actual source of problem. Thanks for the tip!
Jul 24 2009
asd escribió:thanks for quick response! Lutger Wrote:Maybe because it can't instantiante the template. :-) The idea in these cases is to debug the instantiation. Right click on it -> Source -> Debug at Compile Time. The debug view opens, you can step into, and when an error happens it'll be printed in the console at the line where it happens.Not directly except with descent. It's worth it to try descent compile time debugger (and compile time view!), really awesome stuff.It's indeed pretty nice, but unfortunately it doesn't seem to show mixins:public void STARTS_HERE() {} mixin ObjcMethodInfo!(objcForward_isEqual_, BOOL, "isEqual:", id); public void ENDS_HERE(int h) {}is displayed in Descent's Compile-Time view as:void STARTS_HERE() { } void ENDS_HERE(int h) { }
Jul 25 2009
Ary Borenszweig escribió:asd escribió:But now I see "D2". Still not supported by Descent, awww...thanks for quick response! Lutger Wrote:Maybe because it can't instantiante the template. :-) The idea in these cases is to debug the instantiation. Right click on it -> Source -> Debug at Compile Time. The debug view opens, you can step into, and when an error happens it'll be printed in the console at the line where it happens.Not directly except with descent. It's worth it to try descent compile time debugger (and compile time view!), really awesome stuff.It's indeed pretty nice, but unfortunately it doesn't seem to show mixins:public void STARTS_HERE() {} mixin ObjcMethodInfo!(objcForward_isEqual_, BOOL, "isEqual:", id); public void ENDS_HERE(int h) {}is displayed in Descent's Compile-Time view as:void STARTS_HERE() { } void ENDS_HERE(int h) { }
Jul 25 2009
Ary Borenszweig schrieb:But now I see "D2". Still not supported by Descent, awww...Unfortunately, yes :(
Jul 26 2009