<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hacker News: SuperV1234</title><link>https://news.ycombinator.com/user?id=SuperV1234</link><description>Hacker News RSS</description><docs>https://hnrss.org/</docs><generator>hnrss v2.1.1</generator><lastBuildDate>Sun, 24 May 2026 21:38:38 +0000</lastBuildDate><atom:link href="https://hnrss.org/user?id=SuperV1234" rel="self" type="application/rss+xml"></atom:link><item><title><![CDATA[New comment by SuperV1234 in "Neoclassical C++: segmented iterators revisited"]]></title><description><![CDATA[
<p>Very interesting, this is the first time I hear about segmented iterators and hierarchical algorithms.<p>I faced a similar issue myself when implementing a chunked vector a la `std::deque`, but opted for callback-based internal iteration, i.e.<p><pre><code>    void ChunkedVector::forEach(auto&& f)
    {
        for (auto& chunk : chunks)
            for (auto& item : chunk) 
                if (f(item) == ControlFlow::Break)
                    return;
    }
</code></pre>
Where `ControlFlow` is just:<p><pre><code>    enum class [[nodiscard]] ControlFlow : bool
    {
        Continue,
        Break
    };
</code></pre>
This is massively simpler to implement, and can model simpler algorithms such as `for_each`, `fill`, `transform`, `count`, `accumulate`.<p>It's sometimes inferior in terms of ergonomics, and cannot express more complicated algorithms or iteration patterns (e.g. partial range, going backwards), but so far it has served me well.<p>Just something to consider if implementation simplicity is the priority and there's no need for a very generic suite of algorithms.</p>
]]></description><pubDate>Sun, 24 May 2026 10:52:20 +0000</pubDate><link>https://news.ycombinator.com/item?id=48256212</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48256212</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48256212</guid></item><item><title><![CDATA[New comment by SuperV1234 in ".NET (OK, C#) finally gets union types"]]></title><description><![CDATA[
<p>Boxed, and needs complex incantations to avoid the boxing. Meh.</p>
]]></description><pubDate>Sat, 23 May 2026 22:36:01 +0000</pubDate><link>https://news.ycombinator.com/item?id=48252270</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48252270</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48252270</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>That's a strange dismissal. `Optional<T>` isn't "perceived" safety -- it eliminates a whole category of bugs (null dereferences, uninitialized reads) at the type-system level, with zero runtime overhead versus a raw pointer or sentinel value.<p>If you think that's uninteresting, that's an aesthetic preference, not a technical argument.<p>But let's set that aside, because it's also irrelevant to the compile-time claim.<p>The point of the example wasn't "look at this fascinating class," it was "here is a real template, used 911 times across the codebase, in a public header -- exactly the scenario you said would be slow -- and it costs under 1ms per instantiation."<p>You can swap `Optional` for any non-trivial template of similar complexity and the numbers will look similar.<p>On your 1 MLOC/sec benchmark: that's a fair reference point for C-like code, but it's not the right yardstick for template instantiation, which is doing semantic work (overload resolution, SFINAE, constraint checking) that a C compiler simply isn't.<p>Comparing them is comparing different jobs.<p>The honest question is whether template compilation is slow relative to what it's actually doing, and in well-structured code, it isn't.<p>And yes, `Optional.hpp` is a header -- that's the whole point of the demonstration. I'm not claiming you should hide every template in a .cpp file. I'm claiming that even templates in headers, instantiated hundreds of times, are cheap when written with compile times in mind.<p>The "put templates in .cpp where it makes sense" advice is for the specific cases, not a blanket rule.</p>
]]></description><pubDate>Thu, 14 May 2026 22:13:27 +0000</pubDate><link>https://news.ycombinator.com/item?id=48141968</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48141968</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48141968</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>So? The original argument was about the "ugly" syntax that the user didn't want to interact with nor read. I proved that there's no need to do so to consume reflection utils.</p>
]]></description><pubDate>Thu, 14 May 2026 17:16:12 +0000</pubDate><link>https://news.ycombinator.com/item?id=48138246</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48138246</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48138246</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>Alright, I'll bite.<p>This is my `sf::base::Optional<T>` template class, a lightweight replacement for `std::optional` with same semantics:
<a href="https://github.com/vittorioromeo/VRSFML/blob/master/include/SFML/Base/Optional.hpp" rel="nofollow">https://github.com/vittorioromeo/VRSFML/blob/master/include/...</a><p>This is what ClangBuildAnalyzer reports:<p><pre><code>  **** Template sets that took longest to instantiate:
     833 ms: sf::base::Optional<$> (911 times, avg 0 ms)
</code></pre>
Each individual instantiation of this class is sub 1ms.
Including the header itself takes 3ms.<p>I'm sure I can optimize it even further if I wanted to.<p>---<p>Now to refute your other incorrect claims:<p>> The point of templates is generic programming, reusable components.<p>That's ONE use case. A more general use case is just reducing code repetition in a type-safe manner, which is extremely useful even within the same translation unit. Another use case is metaprogramming. And I'm sure I can come up with more. Templates are a versatile tool.<p>> And if you have to "selectively pick TUs where they're instantiated", you're basically admitting that you have to invest effort to reduce compile times.<p>...well, yeah? Of course you have to put in effort to reduce compile times. That doesn't undermine my point at all.<p>C++ templates are not slow to compile.</p>
]]></description><pubDate>Thu, 14 May 2026 14:46:16 +0000</pubDate><link>https://news.ycombinator.com/item?id=48136192</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48136192</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48136192</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Rewrite Bun in Rust has been merged"]]></title><description><![CDATA[
<p>I'm bullish on LLM-assisted development but this is just a very stupid way of performing such a critical migration.</p>
]]></description><pubDate>Thu, 14 May 2026 13:48:00 +0000</pubDate><link>https://news.ycombinator.com/item?id=48135335</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48135335</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48135335</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>That's just false. Templates are not slow to compile at all, and you can selectively pick TUs where they're instantiated.<p>My entire VRSFML codebase compiles from scratch in ~4s and I liberally use C++ features, I just avoid the Standard Library most of the time.<p>Templates are not inherently slow, people just don't know how to use them and don't know how to control instantiation.<p>Most people still think that templates have to go in header files, which is also just plainly false.</p>
]]></description><pubDate>Thu, 14 May 2026 13:20:43 +0000</pubDate><link>https://news.ycombinator.com/item?id=48135022</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48135022</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48135022</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>This is a myth, C++ is not inherently slow to compile. It's the standard library that is very bloated and the main culprit for slow compilation.</p>
]]></description><pubDate>Thu, 14 May 2026 09:44:55 +0000</pubDate><link>https://news.ycombinator.com/item?id=48133136</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48133136</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48133136</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>Utter BS. Compilation times matter for productivity, developer motivation, iteration speed, CI turnaround time, and so on.<p>I'm sure you wouldn't say "it doesn't matter how long it takes to compile" it if took <i>days</i>. So where do you draw the line? Regardless, it matters.</p>
]]></description><pubDate>Thu, 14 May 2026 09:44:01 +0000</pubDate><link>https://news.ycombinator.com/item?id=48133130</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48133130</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48133130</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>No, it objectively isn't objective.</p>
]]></description><pubDate>Thu, 14 May 2026 09:41:00 +0000</pubDate><link>https://news.ycombinator.com/item?id=48133108</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48133108</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48133108</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>Package? We're suggesting to copy paste 5 lines and stick them into a header.</p>
]]></description><pubDate>Thu, 14 May 2026 09:40:40 +0000</pubDate><link>https://news.ycombinator.com/item?id=48133105</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48133105</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48133105</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p><p><pre><code>  #include "to_enum_string.h"
</code></pre>
You don't have to understand it to use it. Even then, it's not that hard to understand, it just looks unfamiliar.</p>
]]></description><pubDate>Thu, 14 May 2026 08:48:53 +0000</pubDate><link>https://news.ycombinator.com/item?id=48132724</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48132724</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48132724</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>The parent comment is quite clear:<p>> Why do I have to be familiar with all those weird symbols just to do a trivial thing ?<p>And my answer demonstrates that you do <i>not</i> have to.</p>
]]></description><pubDate>Wed, 13 May 2026 22:19:31 +0000</pubDate><link>https://news.ycombinator.com/item?id=48128361</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48128361</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48128361</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>It works generally, but not with expansion statements. See section 3.2 here:
<a href="https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p1306r4.html" rel="nofollow">https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p13...</a><p>It seems that this is being worked on, and eventually the `define_static_array` won't be needed anymore</p>
]]></description><pubDate>Wed, 13 May 2026 22:03:09 +0000</pubDate><link>https://news.ycombinator.com/item?id=48128204</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48128204</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48128204</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>To be honest there are ways to make that much nicer. I believe that if you use recursive macros using the VA_OPT feature, you should be able to provide enumerators directly to define enum as a list.<p>The underlying machinery implementation is going to be much uglier and complex, though.<p>See <a href="https://www.scs.stanford.edu/~dm/blog/va-opt.html" rel="nofollow">https://www.scs.stanford.edu/~dm/blog/va-opt.html</a></p>
]]></description><pubDate>Wed, 13 May 2026 20:56:17 +0000</pubDate><link>https://news.ycombinator.com/item?id=48127446</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48127446</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48127446</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>By <i>your</i> logic we shouldn't ever use external libraries.<p>PFR has given us reflection since C++14.<p>I also don't think the Standard Library is particularly well-defined nor well-implemented, as demonstrated by the atrocious compilation times.</p>
]]></description><pubDate>Wed, 13 May 2026 20:53:48 +0000</pubDate><link>https://news.ycombinator.com/item?id=48127412</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48127412</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48127412</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>It is kind of weird at first but the reason is that `std::vector` requires heap allocation and transient allocations are not allowed in `constexpr` contexts. The purpose of `std::define_static_array` is to promote the storage of the vector to static storage to eliminate the transient allocation issue, and so that the `template for` can work properly with it.<p>See wg21.link/P3491</p>
]]></description><pubDate>Wed, 13 May 2026 20:50:13 +0000</pubDate><link>https://news.ycombinator.com/item?id=48127370</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48127370</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48127370</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>This cost is not significant nowadays, it's the frontend/parsing time.<p>You can also use `#pragma once` which works everywhere, is nicer, and technically needs less work by the compiler, but compilers have optimized for include guards since a long time ago.<p>Some random measurements I found: <a href="https://github.com/Return-To-The-Roots/s25client/issues/1073" rel="nofollow">https://github.com/Return-To-The-Roots/s25client/issues/1073</a></p>
]]></description><pubDate>Wed, 13 May 2026 20:46:10 +0000</pubDate><link>https://news.ycombinator.com/item?id=48127326</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48127326</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48127326</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>It's a fair comparison. The parent comment isn't showing the compiler source code for the built-in reflection mechanisms.<p>You won't have to care about ^^ and [:X:] if you just want to consume reflection-based utils, which was the whole point of my comment.</p>
]]></description><pubDate>Wed, 13 May 2026 18:11:18 +0000</pubDate><link>https://news.ycombinator.com/item?id=48125402</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48125402</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48125402</guid></item><item><title><![CDATA[New comment by SuperV1234 in "Cost of enum-to-string: C++26 reflection vs. the old ways"]]></title><description><![CDATA[
<p>C++:<p><pre><code>  enum Color { red, green, blue };
  auto name = to_enum_string(Color::Red); // "Red"</code></pre></p>
]]></description><pubDate>Wed, 13 May 2026 15:39:50 +0000</pubDate><link>https://news.ycombinator.com/item?id=48123361</link><dc:creator>SuperV1234</dc:creator><comments>https://news.ycombinator.com/item?id=48123361</comments><guid isPermaLink="false">https://news.ycombinator.com/item?id=48123361</guid></item></channel></rss>