Live data from Hacker News

Show HN: C++ runtime/compile-time detection in constexpr functions

github.com

11–20 of 22 posts

Re: Show HN: C++ runtime/compile-time detection in constexpr functions

#11
In my libbug library, computation at Compile-Time uses the exact same language as the run-time

  {at-both-times
   {define fact
     [|n| (if (= n 0)
              [1]
              [(* n (fact (- n 1)))])]}}

  (pp {at-compile-time-expand   (fact 3)})
  (pp (fact 3))
https://github.com/billsix/bug

Re: Show HN: C++ runtime/compile-time detection in constexpr functions

#15

As with most things in C++ that looks horribly convoluted for some very simple functionality. In D all we have to do is: * `if ( __ctfe) { ... }` for compile time * `if (!__ctfe) { ... }` for runtime

I don't think it's any secret D does CTFE better than any other language.

Re: Show HN: C++ runtime/compile-time detection in constexpr functions

#16

As with most things in C++ that looks horribly convoluted for some very simple functionality. In D all we have to do is: * `if ( __ctfe) { ... }` for compile time * `if (!__ctfe) { ... }` for runtime

I don't think it's any secret D does CTFE better than any other language.

Better than Common Lisp?
Post reply on HN