July 20, 2012 Re: Add CTFE execute function | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | 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.
| |||
July 20, 2012 Re: Add CTFE execute function | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Chang Long | 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 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply