Post B51axQv0MGlJU5hSPA by shitpostalotl@axfedi.derg.rest
 (DIR) More posts by shitpostalotl@axfedi.derg.rest
 (DIR) Post #B50Wq0k0h0ANILnpSa by thephd@pony.social
       1 likes, 0 repeats
       
       A r e   y o u   r e a d y   t o   h a v e   s o m e   f u n   ?:3
       
 (DIR) Post #B50XAXU4fGoUdZ8ZrE by thephd@pony.social
       0 likes, 0 repeats
       
       "This is going to destroy my build system"Nope! It's able to determine everything that will be processed by the Phase 7 compile-time-computed strings by Phase 4, and presents all of that information through already-available means, meaning CMake/build2/meson/make/ninja/etc. can all understand the dependency chain here natively!
       
 (DIR) Post #B50XCvuQp7psyAbiUK by atax1a@infosec.exchange
       0 likes, 0 repeats
       
       @thephd what the fuck
       
 (DIR) Post #B50Yav0RvrEj4bQIUq by thephd@pony.social
       0 likes, 0 repeats
       
       @MonniauxD we are parsing Lua, including the "require" statement, at compile-time in C++. I can not only access a single file, but parse it and walk into other required/imported/included files, before the execution of the program ever begins.
       
 (DIR) Post #B50YuzMRS1zWN3HQUC by thephd@pony.social
       0 likes, 0 repeats
       
       Ultimately, this means we can process files -- recursively -- at compile-time, meaning that rather than embedded shaders with #​includes that can't be touched, we can process those includes and make true single blobs without extra build steps.compile-time python with imports is VERY possible.
       
 (DIR) Post #B50bIJFrqrzmdiS9M8 by uecker@mastodon.social
       0 likes, 0 repeats
       
       @thephd  Cool, but why?
       
 (DIR) Post #B50fPHy5QyCgUaifyq by thephd@pony.social
       0 likes, 0 repeats
       
       @uecker C++ has capabilities that can make great use of this. A perfect example is using (Generative) reflection to generate, at compile-time, the perfect FFI that maps to Python, or Lua, or JavaScript, with all of the utility that comes from having it mapped perfectly to C(++) interfaces and fully type-checked while always being generated directly from said Lua or Python or JavaScript source code.This also applies to things like e.g. Rust and C++ interop, which has also been the topic of discussion and monetary investment. (Not that they're paying me; I wish they would, I could do a lot more for them than just std::embed.)C doesn't have the systems in place to do things like this, so in most cases they'd just have to rely on the usual techniques used today: code generators, hand-written parsers, fresh data files and description files used to drive code generation (like e.g. SWIG). Certainly not bad, but not nearly as "automated luxury FFI" as C++ can make it.
       
 (DIR) Post #B50fWWCmto9mfv2k5o by uecker@mastodon.social
       0 likes, 0 repeats
       
       @thephd  What I do not understand is why the extra build step is a problem.
       
 (DIR) Post #B50fglI3fUg8M9OPy4 by thephd@pony.social
       0 likes, 0 repeats
       
       @uecker I don't think the extra build step is the problem. I think the ability to e.g. parse C++ or C code and generate the proper FFI to connect to other languages, or vice versa, is a tooling investment that isn't really a fully solved problem.
       
 (DIR) Post #B50fthMjZSx9wtkTbM by uecker@mastodon.social
       0 likes, 0 repeats
       
       @thephd  Ok, but why does it need to be solved by compile-time interpretation and not simply be a tool one runs during built?   To me,  this seems to solve the problem at the wrong place and using poorly suited tools (a compiler is not a good interpreter). And my only explanation so far is that people are nerd-sniped into doing it.
       
 (DIR) Post #B50gGYX0aC81D6SBqS by thephd@pony.social
       0 likes, 0 repeats
       
       @uecker If that's all you took from this, okay!
       
 (DIR) Post #B50lzeFAgtNljFQod6 by mia@shrimptest.0x0.st
       0 likes, 0 repeats
       
       @thephd @uecker take a look at fftw3’s build system and i think several use cases for this kind of compile-time functionality will become apparrent. for example, it currently uses some arcane OCaml code generators to turn customizable rules into SIMD code. it’s so unwieldy that the project’s README recommends users only ever build from tarballs with the sources already generated.(after exchanging some emails i ported that whole mess to meson to make it usable but then that didn’t get reviewed at all and i stopped caring)
       
 (DIR) Post #B50lzeSdso9qP1jZcu by mia@shrimptest.0x0.st
       0 likes, 0 repeats
       
       @thephd @uecker my personal opinion is that build systems should not generate code, and code should not depend on build system output. the responsibility of a build system is the build/test/deploy process alone.
       
 (DIR) Post #B50lzeeLBJW0zJCurQ by uecker@mastodon.social
       0 likes, 0 repeats
       
       @mia @thephd  Then let's agree to disagree, because my opinion is that compilers should not be misused as interpreters.
       
 (DIR) Post #B50lzeoyXm1RWIBPRA by uecker@mastodon.social
       0 likes, 0 repeats
       
       @mia @thephd (my personal pain with build systems is typically with CMake where it throws some error and I have no idea where in the thousands of lines of  CMake I am supposed to change something. Especially if it first compiles for a long time and processing constexpr as part of it just makes it worse. )
       
 (DIR) Post #B50lzf25l0VwAyJssi by mia@shrimptest.0x0.st
       1 likes, 0 repeats
       
       @uecker @thephd that’s just cmake being utter garbage (without hyperbole, it has more in common with microsoft batch than it does with an actual build system) that for no apparent reason half the software industry agreed to force on each other, the other half being google’s flavor of the week.qt needs more than 90k lines of code—again, no hyperbole because i’ve ported some of that recently—consisting mostly of cmake workarounds to achieve what meson can express entirely declaratively in just over a hundred. and none of it would have to exist if qt didn’t require 5 or 6 different generators.so i don’t think “this makes bad build systems even more of a pain to use” is a strong argument
       
 (DIR) Post #B50oOnzfmFz77FJ1Ps by uecker@mastodon.social
       0 likes, 0 repeats
       
       @mia @thephd  I certainly agree that CMake is just bad independently of constexpr.   I haven't looked at meson much, but if I needed to build and run a C program to create specialized code it would be a single line in my Makefile. Cross-compilation would be more complicated though.
       
 (DIR) Post #B50oOoFynd1pvow2pk by mia@shrimptest.0x0.st
       1 likes, 0 repeats
       
       @uecker @thephd meson can also handle that case (plus cross compilation and figuring out how to run it if it needs to compiled for a different system/architecture) in a single line as well.but you’ve just said it: cross-compilation breaks the assumptions of many build systems. there aren’t many that properly support the canadian cross to begin with, and there’s a lot of platform-specific quirks that build systems need to figure out to make it all work as well.that’s an incredible amount of jank and moving parts for something that could just be done by the compiler that you already use to compile the generator code.
       
 (DIR) Post #B50s8U4GUeUmV3vVnU by fiore@brain.worm.pink
       0 likes, 0 repeats
       
       can  anybody explain to me  what  the  hell is  going  on herw  i am  so confusionRE: https://pony.social/@thephd/116356158784090920
       
 (DIR) Post #B50tkxS3nFgyafxyBk by ada@zoner.work
       1 likes, 0 repeats
       
       @fiore@brain.worm.pink it's parsing lua and inlining require keywords at compile time (constexpr)so that the lua becomes one giant blob
       
 (DIR) Post #B50tlN9WEoJGIhUWtk by mia@shrimptest.0x0.st
       1 likes, 0 repeats
       
       @fiore it parses lua, including resolving its imports, and then embeds the result. and it does this at compile time, all controlled from source code, with no external tools.
       
 (DIR) Post #B50tnZkmMIvHxdyCrA by fiore@brain.worm.pink
       0 likes, 0 repeats
       
       @mia @ada oh .  thats  kinda  cursed ,  right ??  like .  cool but    cursed ?  like .  damn
       
 (DIR) Post #B50vRSppbJPo2buwFc by mia@shrimptest.0x0.st
       1 likes, 0 repeats
       
       @fiore @ada i don’t think that’s cursed at all. you can for example use this to parse protocol interface definitions and generate them without having to write source code generators
       
 (DIR) Post #B50vT4qJm3DsD4ujtQ by fiore@brain.worm.pink
       0 likes, 0 repeats
       
       @mia @ada OHHH  I SEE  NOW
       
 (DIR) Post #B50vTRYNKvXKe5hEcS by mia@shrimptest.0x0.st
       1 likes, 0 repeats
       
       @fiore @ada or like the OP already mentions, fully automated luxury FFI
       
 (DIR) Post #B50vTWkG2B0okOIIKm by mia@shrimptest.0x0.st
       1 likes, 0 repeats
       
       @fiore @ada so this actually solves real problems that are usually a pain in the ass
       
 (DIR) Post #B50w4lUUAnMbC7fnou by ada@zoner.work
       1 likes, 0 repeats
       
       @mia@shrimptest.0x0.st @fiore@brain.worm.pink not cursed at all since it's essentially the same that ends up happening in the lua runtimeit simplifies a lot since you don't have to handle file opens from lua's side.
       
 (DIR) Post #B51IECACZUYpW65Tu4 by shitpostalotl@axfedi.derg.rest
       0 likes, 0 repeats
       
       @thephd i'm trying my best to understand what is going on here, and what i think is happening is that you have made lua into a compiled language hosted(??) in c. is that correct?
       
 (DIR) Post #B51IECKTxGmg1ytgvY by thephd@pony.social
       0 likes, 0 repeats
       
       @shitpostalotl C++, not C. God forbid C having this kind of power.
       
 (DIR) Post #B51JArVuzRyQYfDgC8 by NekkoDroid@social.treehouse.systems
       0 likes, 0 repeats
       
       @thephd Wait, is there some update on std::embed in the standard library that I missed or is it still not a thing?
       
 (DIR) Post #B51JArhGJH317qWjsO by thephd@pony.social
       0 likes, 0 repeats
       
       @NekkoDroid just trying to finish it off, yeah.
       
 (DIR) Post #B51JEj0gY5atLIS7pg by thephd@pony.social
       0 likes, 0 repeats
       
       @NekkoDroid (It's not in C++ yet, this is a personal branch.)
       
 (DIR) Post #B51axQv0MGlJU5hSPA by shitpostalotl@axfedi.derg.rest
       0 likes, 0 repeats
       
       @thephd i definitely don't understand c++ to know which c++-exclusive features you're using to make this happen that can't be used in c. this is basically wizard techniques to me. question though: since lua is being compiled, does this mean that it could have compile-time errors for things that would have only shown up while running the program previously?
       
 (DIR) Post #B51axR6hem7U4NAndg by thephd@pony.social
       0 likes, 0 repeats
       
       @shitpostalotl yes, you can turn all of those errors into compile-time C++ errors. (I have not done this yet, just implemented gluing the two files together at C++-compile-time.)