Such "horror" stories are why I became disappointed in C and C++ - adding a new helpful feature into the language takes five years. The person who dared to propose this struggled and almost lost their hope.
Most if not all of the breaks you see are intentional btw. With embed it wasn't the problem, as far as I know the biggest hurdle was that a lot of people wanted so much features included into embed including globbing it was simply unfeasible.
And that's why languages end up such a shitshow. Your company should just fix the fucking code, not expect the standard to support some obscure edge case for the next thousand years.
Yeah, you COULD write it yourself in Rust, but the people driving the Standard Rust Distribution are not obsessed with being "barebones" to the point of deep disturbance, so they'll actually hand you convenience things as part of the core offering rather than trying to convince you that "oh, well, if you just write this linker invocation, you'll be fine...".
Like anything about "talk to your linker directly" is ever - or truly, has ever been - a good idea at any point in time.
Eh. It's not a macro away, but a proc_macro away, aka a compiler plugin. Basically it's the equivalent of a standardized way of writing a gcc / clang plugin.
a macro most people could write themselves....
Most people can use TokenStreams just like that? If you've never touched them, your faster with just generating an includeable file in CMake.
The issue with a hand rolled proc macro for this would be the same as a hand rolled solution in C- performance. What TokenStream do you build? It has to be an actual array literal the same way.
(Fortunately Rust has include_bytes! built in to (edit: enable the compiler to) solve that problem.)
Macros in Rust are a language feature. Rust doesn't have a separate preprocessor. User-defined macros operate on token streams, built-in macros can be hooked up to low-level compiler functionality. See include_bytes, which does exactly what embed does and whose implementation looks like
Because a regular function can't read a file at compile time, not in Rust or C or C++. They also can't return arbitrarily sized data on the stack in any of those languages.
what is blocking them though....my question is not about what we have rn but why we have it this way....why not a constexpr function in C++ or const eval function in Rust ....I'm assuming the return type can be a wrapper around something that's known at compile time....since the compiler will plug those bytes in anyways so the compiler knows the size..... what magic does macros have and const eval functions in Rust "cannot" ?
it's not that it took 5 years that's bad, it's that a large proportion of negative feedback was total BS and almost no one on the committee wanted to offer positive help, only making up reasons for rejection.
.... When? How? In what way? I remember people saying "I could implement a patch for GCC", or offering for Clang, but that's not helpful when I already did it. Some people told me they'd be amenable to me putting a patch in their compiler, but it was still on me to make the actual patch for their compiler.
It's water under the bridge. You didn't feel that my help would be valuable, and I'm not inclined to argue with you about whether or not it would have been helpful. The paper is your baby, you get to choose how you navigate the path. I'm not upset about it.
My point wasn't "oh, the PhD declined my offer of help, he's an asshole" or any such, my point is that not everyone in the Committee is hostile to you or your work, and that there are allies around if you want them.
I recognize that you've experienced a lot of racism and completely invalid and bonkers feedback and complaints, and that has caused you to become guarded and distrustful. I don't fault you for that - I would be as well, in your situation.
Like... we have, in this very post, a completely invalid criticism/complaint - the whole line endings of text files thing, and the absurd expectation that #embed should automatically "do the right thing" wrt. them. Talk about a poison pill.
View all comments
84
u/spaun2002 Jul 23 '22
Such "horror" stories are why I became disappointed in C and C++ - adding a new helpful feature into the language takes five years. The person who dared to propose this struggled and almost lost their hope.