|
Proto : |
Subject: Re: [proto] talking proto
From: Eric Niebler (eric_at_[hidden])
Date: 2010-07-19 23:04:06
On 7/18/2010 5:56 PM, OvermindDL1 wrote:
> Haskall is also something good to model, it is kind of like the above,
> and like the above you can think of both as like a meta-programming
> language that is mostly executed at compile-time to generate very
> efficient runtime code. I do that with the toy language I created
> (list-like syntax and power, but no shared state and some other
> changes), it is not executed procedurally, but is rather executed at
> compile-time, which then generates LLVM code based on what it
> generated, which is then optimized by LLVM and JIT'ed.
Sounds intriguing. I'd have to get my hands in it to really grok that,
though.
> Lisp style
> macro's make that so easy to do as well.
So I'm told. ;-)
> You might also look at D, its template support is vastly more powerful
> then C++'s while retaining the same feel
<snip>
Ha, yes I know quite a bit about D. Little known fact: I regularly
attended the weekly BS sessions with Walter Bright, Andrei Alexandrescu
and others to design D2 (although I mostly just sat and listened).
> I always kind of thought of playing around with that, using Clang to
> create a C++D language
Dear god, why? If you prefer D, then by all means use it! :-)
> And the one feature that
> would be nice to bring to C++ that I have not mentioned yet, are
> mixins[1].
<snip>
Grumble. Mixins are about as horrible as the C preprocessor. No, more so
because they're more powerful, and equally dangerous. If it's your goal
to manipulate /code/, why manipulate /strings/? Isn't the Lisp way
better? I'd rather manipulate syntax trees than hack together some
Frankenstein monster by building a string at compile time (!!!) and
barfing it into some arbitrary context. Sorry, did that make me sound
opinionated?
I get the impression that even Walter and Andrei have misgivings about
mixins.
> That would be such a fascinating idea to carry out, C++ needs to be
> extended with such new constructs, it needs full compile-time
> reflection
Ah, here I agree. But without the ability to traverse and manipulate the
AST at compile time, reflection can only get you so far.
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Proto list run by eric at boostpro.com