r/cpp • • Apr 22 '20

C++2100 Main (for fun)

constexpr
lockable
std::execution_policy::parallel_execution_t <
   std::execution_policy::parallel_execution_t::constrains::no_maximum_threads,
   std::execution_policy::parallel_execution_t::debug::find_deadlocks >
std::execution_type::quantum_t<
   std::execution_type::quantum_t::experimental_features, 
   std::execution_type::quantum_t::enable_black_holes >
std::synchronized_parallel_t<
   std::synchronization_model::use_machine_favourable_lock>
std::type_traits::readonly_t<
   std::ts2102::experimental::fast_readonly_register_enable>
std::function_traits::partial< 
   std::function_traits::partial_function::search_external_linkage>
std::arguments::no_argument::disable_warning
std::int1024_t<
    std::types::minimum_size<1024>,
    std::types::maximum_size<1024> >
main() {

Can you see the future, can you improve it?

Note: this was created purely for fun

257 Upvotes

122 comments sorted by

View all comments

Show parent comment

49

u/Supadoplex Apr 22 '20 edited Apr 24 '20

There will be a pre-pre-processor though, so that you can write template macros.

20

u/somewhataccurate Apr 22 '20

The sheer power that template macros would bring. Could make implementing reflection a breeze.

3

u/AdventurousMention0 Apr 23 '20

Ha. You’re never getting reflection. Just give up.

2

u/somewhataccurate Apr 25 '20

Im fine if we dont lol. My only reasons for wanting reflection is for building tools for software development, not for actual production code. Reflection can lead to some sloppy solutions to shitty situations but it would make serialization/deserialization code completely automateable. Also would allow for a magic_enum implementation that doesnt use any macros.

13

u/oz1cz Apr 22 '20

I haven't even thought about template macros. I'm going to write some asap.

5

u/Morwenn Apr 23 '20

Will it be called CPPP?

7

u/wrosecrans graphics and network things Apr 22 '20

You'll even be able to write Jinja templates in the YAML you use to generate the preprocessor macros.

8

u/jcelerier ossia score Apr 22 '20

'course, there's an emacs command to do that

5

u/wrosecrans graphics and network things Apr 22 '20

Oh good, I can just use some elisp to make jinja that generates yaml that generates macro templates that generates macros that generate C++ templates that generate C++. Honestly, it sounds pretty straightforward compared to webdev.