Hacker News new | past | comments | ask | show | jobs | submit login

A snippet from the paper that made me understand what this is about:

  // $ is the reflection operator and T is a type.
  constexpr { // execute this at compile time
   for... (auto m : $T.variables()) // examine each member variable m in T
     if (m.name() == “xyzzy”) // if there is one with name “xyzzy”
       -> { int plugh; } // then inject also an int named “plugh”
  }
This would inject "int plugh;" in the scope surrounding the constexpr block.



This kind of compile-time code is a great substitute for things people currently do with template metaprogramming or code generators.


reminds me of http://terralang.org/



I have hopes that Jai will be at a very nice local optimum regarding performance and productivity, but I think just like in C++, safety is not a major design goal (you need to be unsafe if working with memory mapped structs).


> you need to be unsafe if working with memory mapped structs

Perhaps when defining their address and layout, or if they are a hardware structure that affects memory like a page table or TLB or a DMA controller, but beyond that, why? Or is that just the main use case you're describing?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: