Skip to content

Comment on A new C++ back end for ocamlcparent

Comments

Most of it yes, but what about:

    typedef I<((I<((n::val (p::val))>::val) != (I<0>::val))> res;
    };
There is some top class wizardry going on there! I don’t think I’ve ever used conditions in a type definition in C++ :)

Update:

Ah, alright - so that evaluation logic is part of the template, not the code that eventually compiles.

It’s basically offloading some of the higher level language compiler logic to the templating engine. Honestly might be a better time investment than spending more time writing this in the parser.

Now I’m sort of intrigued and inspired to use C++ as a lowering target for elevate (a compiler framework I’ve been working on).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.