digitalmars.D - Maybe another way to do compile time rewrites
- aaaaa (23/23) Jun 20 2014 Currently what happens is you do
- Tofu Ninja (4/28) Jun 20 2014 If that was as effective as doing it at compile time, then any
- Ary Borenszweig (4/25) Jun 21 2014 It's not complex at all, and it's a great idea (and it seems more and
- aaaaa (3/7) Jun 22 2014 Oh dear! I should have spent more time googling to see if there
Currently what happens is you do dmd program1.d and program1.d uses mixin and compile time reflections to internally rewrite itself to be effectively program2.d so dmd program1.d and dmd program2.d are the same. However another possible way might be rdmd program3.d > program2.d dmd program2.d That is, program3.d would (at runtime) generate program2.d which you can then compile. This has the advantage of being possibly faster and simpler, because you don't have to do everything at compile time. Recent talks have lamented at the limited tools available for compile time debugging and if you generate the code at runtime, you have access to all the runtime facilities for debugging code. This also removes the restriction of not being able to do system calls during compile time because you can do whatever you want during the runtime of program3.d I have no idea how much more complex this would be and am just thinking out loud. Anyway, thanks everyone for developing and maintaining D!
Jun 20 2014
On Saturday, 21 June 2014 at 04:34:50 UTC, aaaaa wrote:Currently what happens is you do dmd program1.d and program1.d uses mixin and compile time reflections to internally rewrite itself to be effectively program2.d so dmd program1.d and dmd program2.d are the same. However another possible way might be rdmd program3.d > program2.d dmd program2.d That is, program3.d would (at runtime) generate program2.d which you can then compile. This has the advantage of being possibly faster and simpler, because you don't have to do everything at compile time. Recent talks have lamented at the limited tools available for compile time debugging and if you generate the code at runtime, you have access to all the runtime facilities for debugging code. This also removes the restriction of not being able to do system calls during compile time because you can do whatever you want during the runtime of program3.d I have no idea how much more complex this would be and am just thinking out loud. Anyway, thanks everyone for developing and maintaining D!If that was as effective as doing it at compile time, then any language could do it and we would have never needed/wanted all the compile time features that we have now.
Jun 20 2014
On 6/21/14, 1:34 AM, aaaaa wrote:Currently what happens is you do dmd program1.d and program1.d uses mixin and compile time reflections to internally rewrite itself to be effectively program2.d so dmd program1.d and dmd program2.d are the same. However another possible way might be rdmd program3.d > program2.d dmd program2.d That is, program3.d would (at runtime) generate program2.d which you can then compile. This has the advantage of being possibly faster and simpler, because you don't have to do everything at compile time. Recent talks have lamented at the limited tools available for compile time debugging and if you generate the code at runtime, you have access to all the runtime facilities for debugging code. This also removes the restriction of not being able to do system calls during compile time because you can do whatever you want during the runtime of program3.d I have no idea how much more complex this would be and am just thinking out loud. Anyway, thanks everyone for developing and maintaining D!It's not complex at all, and it's a great idea (and it seems more and more people are concluding what you just concluded). See this: http://forum.dlang.org/thread/lnq5m7$2jiq$1 digitalmars.com
Jun 21 2014
Oh dear! I should have spent more time googling to see if there was already a similar thread made. Thanks for the link and sorry for cluttering the forums!It's not complex at all, and it's a great idea (and it seems more and more people are concluding what you just concluded). See this: http://forum.dlang.org/thread/lnq5m7$2jiq$1 digitalmars.com
Jun 22 2014