D and the world
Jari-Matti Mäkelä
jmjmak at utu.fi.invalid
Thu Apr 26 04:31:57 PDT 2007
eao197 wrote:
> Unfortunately parsing X509 certificates can be very tired task because
> it is necessary to handle ASN.1 data structures, byte ordering,
> calculating digital signatures and so on. Do you want to implement MD5,
> SHA1 or SHA256 via CTFE and templates? :)
No :), I was just pointing out that you can do this with D too. I'm not
sure how much better Nemerle would do.
> It would be great if ordinary D code/libraries/wrappers-for-C-libraries
> can be used in compile-time. But I don't know how it can be done in D.
> As I've said previously it is not necessary at all, because we can use
> external code generation.
Just follow the restrictions CTFE has, then you can basically run any
algorithm as if it was run at runtime. It does not allow running C code
because of the linking phase and library dependencies, but porting the
code would not be a problem.
Interpreting metaprograms is so much slower than running separate tools
that I would probably keep them separate if possible unless there are
some other benefits.
> Another interesting idea which can be used for some kind of DSL
> (especially in Don Clugston's computation examples) is a staged
> compilation. For example see Jumbo project for Java:
> http://loome.cs.uiuc.edu/Jumbo/
This is very much like templates, but with a special preprocessor
syntax. I didn't read it all yet, but it looks interesting. I wonder why
hasn't it gained much popularity.
>> CTFE and templates are already Turing complete so you won't get much
>> more with additional macro features.
>
> It is said that C++ templates are Turing complete too :))
Will you excuse me while I go puke... :P No, seriously, CTFE is
something totally different from C++ templates in terms of usability.
More information about the Digitalmars-d
mailing list