templates and files.
Daniel Keep
daniel.keep+lists at gmail.com
Sun Jan 7 07:32:12 PST 2007
kenny wrote:
> I was looking at h3retic's raytracer, and it got me thinking about using
> d's templates as a parser. Seriously thinking actually. The template
> language is strong enough, do you suppose we could use some of the
> phobos file functions inside of D templates to allow for file input and
> output?
>
> Uses I can think of off of the top of my head:
>
> 1. instead of having to store revision number in a d file, the template
> can look in .svn/entries or get the output of the linux command "date"
> 2. preparsed resources, including bitmaps, icons, and meshes (for games?)
> 3. preparsed interpreted languages (compiled DMDScript, lol?)
> 4. XML build script options
> 5. gui that is built off of an XML -- at compile time
>
>
> My primary use would be to generate D code based on an external script.
> For example, I could write generic code, then have a configuration file,
> which will be parsed for the directives at compile time instead of
> execution time. Mostly thinking about #5 though.
>
> Kenny
One wonders why you would not just write D code that generates D code as
output... which is *vaguely* what templates are, anyway.
-- Daniel
P.S. Interesting factoid: Haskell is in the odd position of having a
type system so powerful, it's Turing-complete. Now THAT'S scary.
P.P.S. Actually, scary would be a program that generates D code written
in D, compiled to a turing machine tape, which is run by code written in
the C preprocessor, which is run by a CPP written in the Haskell type
system, compiled for another turing machine built using LEGO. *brainsplode*
More information about the Digitalmars-d
mailing list