digitalmars.D - Add CTFE execute function
- "Chang Long" <changlon gmail.com> May 26 2012
- "Chang Long" <changlon gmail.com> May 27 2012
- Don Clugston <dac nospam.com> May 29 2012
- Nick Treleaven <nospam example.net> Jul 20 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> May 29 2012
- "Tobias Pankrath" <tobias pankrath.net> May 29 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> May 29 2012
- "Tobias Pankrath" <tobias pankrath.net> May 29 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> May 29 2012
- "Tobias Pankrath" <tobias pankrath.net> May 29 2012
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> May 29 2012
- "Chang Long" <changlon gmail.com> Jul 19 2012
CTFE execute will be very useful on web develop, for example It is very hard to create a CTFE version template engine with rich feature. But we can use execute call to transe template file to d code string, then mixed it to application. The vibed project is very cool and I want to add my Jade template to this, but I can't find other way to do it. Maybe we also need a compiler option to enable this CTFE io operate because security.
May 26 2012
On Saturday, 26 May 2012 at 15:56:38 UTC, Chang Long wrote:CTFE execute will be very useful on web develop, for example It is very hard to create a CTFE version template engine with rich feature. But we can use execute call to transe template file to d code string, then mixed it to application. The vibed project is very cool and I want to add my Jade template to this, but I can't find other way to do it. Maybe we also need a compiler option to enable this CTFE io operate because security.
Let me make myself more clear, what I suggestion is something like this: mixin( std.process.execute("/usr/bin/template_engine template_file_path.htm") );
May 27 2012
On 28/05/12 03:40, Chang Long wrote:On Saturday, 26 May 2012 at 15:56:38 UTC, Chang Long wrote:CTFE execute will be very useful on web develop, for example It is very hard to create a CTFE version template engine with rich feature. But we can use execute call to transe template file to d code string, then mixed it to application. The vibed project is very cool and I want to add my Jade template to this, but I can't find other way to do it.
You can do a lot with import(filename);Maybe we also need a compiler option to enable this CTFE io operate because security.
Let me make myself more clear, what I suggestion is something like this: mixin( std.process.execute("/usr/bin/template_engine template_file_path.htm") );
May 29 2012
On 20/07/2012 03:08, Chang Long wrote:Let me make myself more clear, what I suggestion is something like this: mixin( std.process.execute("/usr/bin/template_engine template_file_path.htm") );
When translate the template code to D code, need a lot D type arguments information. And one Web application may need very many page, and the type may change frequently. If I am not doing it on the CTFE will geometric increase workload. If D want to be participants in the web field, I think that this feature sooner or later will be needed.
By coincidence, Walter recently mentioned something similar being integrated into D to support DStep: http://forum.dlang.org/post/jta97l$10hm$1 digitalmars.com So perhaps the above mixin would be: import "template_file_path.htm"; According to the link, that would execute: htm_to_D template_file_path.htm The htm_to_D program would generate a .d module which would then get imported. Nick
Jul 20 2012
--f46d0435c1d20cb63f04c12a0408 Content-Type: text/plain; charset=UTF-8 Yeah, but it requires re-implementing all those tools. If you already have them implemented in D, then it's not a problem, but if you don't or they are closed-source, then import(filename) won't do much good. On Tue, May 29, 2012 at 1:46 PM, Don Clugston <dac nospam.com> wrote:On 28/05/12 03:40, Chang Long wrote:On Saturday, 26 May 2012 at 15:56:38 UTC, Chang Long wrote:CTFE execute will be very useful on web develop, for example It is very hard to create a CTFE version template engine with rich feature. But we can use execute call to transe template file to d code string, then mixed it to application. The vibed project is very cool and I want to add my Jade template to this, but I can't find other way to do it.
Maybe we also need a compiler option to enable this CTFE io operate because security.
Let me make myself more clear, what I suggestion is something like this: mixin( std.process.execute("/usr/bin/**template_engine template_file_path.htm") );
-- Bye, Gor Gyolchanyan. --f46d0435c1d20cb63f04c12a0408 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Yeah, but it requires=C2=A0re-implementing=C2=A0all those tools. If you alr= eady have them implemented in D, then it's not a problem, but if you do= n't or they are closed-source, then import(filename) won't do much = good.<br> <br><div class=3D"gmail_quote">On Tue, May 29, 2012 at 1:46 PM, Don Clugsto= n <span dir=3D"ltr"><<a href=3D"mailto:dac nospam.com" target=3D"_blank"=dac nospam.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" =
<div class=3D"im">On 28/05/12 03:40, Chang Long wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> On Saturday, 26 May 2012 at 15:56:38 UTC, Chang Long wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> CTFE execute will be very useful on web develop, for example It is<br> very hard to create a CTFE version template engine with rich feature.<br> But we can use execute call to transe template file to d code string,<br> then mixed it to application.<br> <br> The vibed project is very cool and I want to add my Jade template to<br> this, but I can't find other way to do it.<br> </blockquote></blockquote> <br></div> You can do a lot with import(filename);<div class=3D"HOEnZb"><div class=3D"= h5"><br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><blockquote class=3D"gmail_quote" style=3D"m= argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br> Maybe we also need a compiler option to enable this CTFE io operate<br> because security.<br> </blockquote> <br> Let me make myself more clear, what I suggestion is something like this:<br=
mixin( std.process.execute("/usr/bin/<u></u>template_engine<br> template_file_path.htm") );<br> </blockquote> <br> <br> </div></div></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>= Bye,<br>Gor Gyolchanyan.<br> --f46d0435c1d20cb63f04c12a0408--
May 29 2012
On Tuesday, 29 May 2012 at 10:08:51 UTC, Gor Gyolchanyan wrote:Yeah, but it requires re-implementing all those tools. If you already have them implemented in D, then it's not a problem, but if you don't or they are closed-source, then import(filename) won't do much good.
You just need a two step build process.
May 29 2012
--bcaec5523980d0af6004c12b7395 Content-Type: text/plain; charset=UTF-8 On Tue, May 29, 2012 at 2:53 PM, Tobias Pankrath <tobias pankrath.net>wrote:On Tuesday, 29 May 2012 at 10:08:51 UTC, Gor Gyolchanyan wrote:Yeah, but it requires re-implementing all those tools. If you already have them implemented in D, then it's not a problem, but if you don't or they are closed-source, then import(filename) won't do much good.
avoid senseless complications. -- Bye, Gor Gyolchanyan. --bcaec5523980d0af6004c12b7395 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Tue, May 29, 2012 at 2:53 PM, Tobias Pankrath= <span dir=3D"ltr"><<a href=3D"mailto:tobias pankrath.net" target=3D"_bl= ank">tobias pankrath.net</a>></span> wrote:<br><blockquote class=3D"gmai= l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left= :1ex"> <div class=3D"im">On Tuesday, 29 May 2012 at 10:08:51 UTC, Gor Gyolchanyan = wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> Yeah, but it requires re-implementing all those tools. If you already have<= br> them implemented in D, then it's not a problem, but if you don't or= they<br> are closed-source, then import(filename) won't do much good.<br> <br> </blockquote> <br></div> You just need a two step build process.<br> <br> <br> </blockquote></div><br>Two-step build process is complicated and tedious. T= he point here is to avoid senseless complications.<br><div><br></div>-- <br=Bye,<br>Gor Gyolchanyan.<br>
--bcaec5523980d0af6004c12b7395--
May 29 2012
On Tuesday, 29 May 2012 at 11:51:34 UTC, Gor Gyolchanyan wrote:On Tue, May 29, 2012 at 2:53 PM, Tobias Pankrath <tobias pankrath.net>wrote:On Tuesday, 29 May 2012 at 10:08:51 UTC, Gor Gyolchanyan wrote:Yeah, but it requires re-implementing all those tools. If you already have them implemented in D, then it's not a problem, but if you don't or they are closed-source, then import(filename) won't do much good.
here is to avoid senseless complications.
If you rely on third party tools for code gen, it will be complicated either way. Going this path means that you have to turn the compiler into a full build system. That finds the right tools in the path, gives good error messages if they are absent, that caches results etc.
May 29 2012
--90e6ba5bb935abe8c004c12f5f2c Content-Type: text/plain; charset=UTF-8 On Tue, May 29, 2012 at 4:02 PM, Tobias Pankrath <tobias pankrath.net>wrote:Going this path means that you have to turn the compiler into a full build system. That finds the right tools in the path, gives good error messages if they are absent, that caches results etc.
build process to zero. This would solve a heap of problems. -- Bye, Gor Gyolchanyan. --90e6ba5bb935abe8c004c12f5f2c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Tue, May 29, 2012 at 4:02 PM, Tobias Pankrath= <span dir=3D"ltr"><<a href=3D"mailto:tobias pankrath.net" target=3D"_bl= ank">tobias pankrath.net</a>></span> wrote:<br><div>=C2=A0</div><blockqu= ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s= olid;padding-left:1ex"> <div class=3D"im">Going this path means that you have to turn the compiler = into a full build system. That finds the right tools in the path, gives goo= d error messages if they are absent, that caches results etc.</div> <br> </blockquote></div><div><br></div>... which is precisely what we need to re= duce all problems related to the build process to zero. This would solve a = heap of problems.<br clear=3D"all"><div><br></div>-- <br>Bye,<br>Gor Gyolch= anyan.<br> --90e6ba5bb935abe8c004c12f5f2c--
May 29 2012
On Tuesday, 29 May 2012 at 16:32:17 UTC, Gor Gyolchanyan wrote:On Tue, May 29, 2012 at 4:02 PM, Tobias Pankrath <tobias pankrath.net>wrote:Going this path means that you have to turn the compiler into a full build system. That finds the right tools in the path, gives good error messages if they are absent, that caches results etc.
related to the build process to zero. This would solve a heap of problems.
If we do that, we should carefully design the system. If we introduce the possiblity to execute arbitrary commands at compile time, we've just introduced the next generation preprocessor.
May 29 2012
--f46d0407160b590c9704c1307f2c Content-Type: text/plain; charset=UTF-8 On Tue, May 29, 2012 at 9:47 PM, Tobias Pankrath <tobias pankrath.net>wrote:On Tuesday, 29 May 2012 at 16:32:17 UTC, Gor Gyolchanyan wrote:On Tue, May 29, 2012 at 4:02 PM, Tobias Pankrath <tobias pankrath.netwrote:
Going this path means that you have to turn the compiler into a fullbuild system. That finds the right tools in the path, gives good error messages if they are absent, that caches results etc. ... which is precisely what we need to reduce all problems related to
build process to zero. This would solve a heap of problems.
If we do that, we should carefully design the system. If we introduce the possiblity to execute arbitrary commands at compile time, we've just introduced the next generation preprocessor.
In any case being able to call external build systems is an important part of any build system. -- Bye, Gor Gyolchanyan. --f46d0407160b590c9704c1307f2c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On Tue, May 29, 2012 at 9:47 PM, Tobias Pankrath= <span dir=3D"ltr"><<a href=3D"mailto:tobias pankrath.net" target=3D"_bl= ank">tobias pankrath.net</a>></span> wrote:<br><blockquote class=3D"gmai= l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left= :1ex"> On Tuesday, 29 May 2012 at 16:32:17 UTC, Gor Gyolchanyan wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> On Tue, May 29, 2012 at 4:02 PM, Tobias Pankrath <<a href=3D"mailto:tobi= as pankrath.net" target=3D"_blank">tobias pankrath.net</a>>wrote:<div cl= ass=3D"im"><br> <br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> Going this path means that you have to turn the compiler into a full build<= br> system. That finds the right tools in the path, gives good error messages<b= r> if they are absent, that caches results etc.<br> <br> <br> </blockquote></div><div class=3D"im"> ... which is precisely what we need to reduce all problems related to the<b= r> build process to zero. This would solve a heap of problems.<br> </div></blockquote> <br> If we do that, we should carefully design the system. If we introduce the p= ossiblity to execute arbitrary commands at compile time, we've just int= roduced<br> the next generation preprocessor.<br> </blockquote></div><br clear=3D"all"><div>In any case being able to call ex= ternal build systems is an important part of any build system.<br></div><di= v><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br> --f46d0407160b590c9704c1307f2c--
May 29 2012
On Tuesday, 29 May 2012 at 09:46:54 UTC, Don Clugston wrote:On 28/05/12 03:40, Chang Long wrote:On Saturday, 26 May 2012 at 15:56:38 UTC, Chang Long wrote:CTFE execute will be very useful on web develop, for example It is very hard to create a CTFE version template engine with rich feature. But we can use execute call to transe template file to d code string, then mixed it to application. The vibed project is very cool and I want to add my Jade template to this, but I can't find other way to do it.
You can do a lot with import(filename);Maybe we also need a compiler option to enable this CTFE io operate because security.
Let me make myself more clear, what I suggestion is something like this: mixin( std.process.execute("/usr/bin/template_engine template_file_path.htm") );
When translate the template code to D code, need a lot D type arguments information. And one Web application may need very many page, and the type may change frequently. If I am not doing it on the CTFE will geometric increase workload. If D want to be participants in the web field, I think that this feature sooner or later will be needed.
Jul 19 2012









Nick Treleaven <nospam example.net> 