HNHacker News
TopNewBestAskShowJobs

gpderetta

13,794 karma · joined February 28, 2014

submissionscomments
gpderetta··on It is time to give up the dualism introduced by the debate on consciousness
If this actually happened, would the 'I' that replaced you be any wiser. How do you know this hasn't happened to you already? Maybe multiple times per second?

> It says "something" survived the utter complete destruction of the physical body and was "put back in it" once it was reassembled. If "it" survived the complete physical destruction of the body, it must be somewhere else, detached from the body.

The information of how to put your body and mind back must have survived somewhere, in the alien mind for example or the machine they used. But the information would still be in (a medium in) this universe and bound to this universe physical laws. I would say this is still a monist position.

A true dualist believes that consciousness survives outside of a medium in this universe.

gpderetta··on I don't think AI will make your processes go faster
I have only been doing this for the last 20 years, so maybe I don't know, but it seems to me that requirement gathering is trivially software engineering. How can you implement something if you do not know what you need to implement. Figuring out what it need to be built and how to build it are closely linked. A good project manager will help collecting any missing domain knowledge, but ultimately it is on the architect to make sure that all the right questions have been asked.

And it is given that not all requirements will have been discovered before a development start or that they may change during development.

gpderetta··on Accelerando (2005)
> Alastair Reynolds

Love Reynolds, but unfortunately he is not half as a good writer as Banks. Then again, not many are.

Reynolods books are full of cool ideas though.

gpderetta··on Accelerando (2005)
> That was an extremely cool but a very far-off, not-in-my-lifetime Sci-Fi fantasy idea when I read it.

The Future Shock is real!

gpderetta··on Accelerando (2005)
It was optimistic in the sense that at least something resembling humanity survives the AI-Apocalypse at least!

[big fan of all your writings here!]

gpderetta··on Accelerando (2005)
accelerando is not exactly obscure!
gpderetta··on Cost of enum-to-string: C++26 reflection vs. the old ways
I don't particularly mind the ^^ and [::] sigils, but the 'template for (constexpr auto ...)' is a bit ugly and hard to explain to a beginner.

But interestingly the code can be improved. The issue is that meta::info[1] is a pure compile time object so in the original code we need to statically unroll the loop of the vector that contains it so that we can splice it in in the loop body. But if we convert it to our own objects, then we can use a plain for loop.

  template<class T>
  constexpr static inline auto reflect_type = ^^T; // not really necessary

  template <typename T>
    requires std::is_enum_v<T>
  constexpr std::string_view to_enum_string(T val)
  {
     struct my_string_view { const char * ptr; size_t sz = strlen(ptr); }; 
     static constexpr auto meta = std::define_static_array(
          std::meta::enumerators_of(reflect_type<T>)
        | std::ranges::views::transform(
        [](auto e) { 
          return std::pair{my_string_view{define_static_string(std::meta::identifier_of(e))}, extract<T>(e)}; 
        }));;

     for (auto [name, value] : meta)        
     {
        if (val == value) { return name; }
     }
     return "<unknown>";
  }
This actually generate less code bloat as, if the array is large it will use a plain loop instead of always unrolling. Also the meta array can now be used for as lookup table for dense enums, while I don't think it is doable with the original version. Supposedly GCC should be able to convert a if chain into a switch statement, but it doesn't seem to trigger here [edit: scratch that: GCC does the switch conversion for the original version].

define_static{_array,_string} still feel as unnecessary magic, but hopefully they are only transient and we will be able to use std::vectors directly. Also somehow GCC doesn't let me use std::string_view and I had to introduce an helper string type.

edit: I literally learned everything I know about static reflection in the last 24 hours. It is complicated, but not that complicated.

[1] Not sure why, I suspect they want to avoid being constrained by ABI.

gpderetta··on Cost of enum-to-string: C++26 reflection vs. the old ways
gcc actually documents this behaviour: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.htm...
gpderetta··on Cost of enum-to-string: C++26 reflection vs. the old ways
Agree that proof of implementation and real world experience should be a requirement for standardization. But it is a catch-22: implement it's are probably not always too keen to spend time on a large feature if it is not clear that it will be standardized.

In practice both clang and VS have had some form of module support for quite a while, but the final standard ended up being different from either implementation (shaped by their experience, and certainly with inevitable last minute inventions).

I wonder if for some features the committee should vote for general guidelines, the delegate a third party (one or more implementors) to come up with both an implementation and standardese with the understanding that it will be fast-tracked in wit too much bike-shedding

gpderetta··on Cost of enum-to-string: C++26 reflection vs. the old ways
The compiler doesn't need to open the same file multiple times. It can remember if a a file is guarded or not every time it sees its name.

My understanding is that this is an optimization that has been available for a very long time now.

The only issue is if a file is referred through multiple names (because of hard links, symlinks, mounts). That might cause the file to be opened again, and can actually break pragma once.

gpderetta··on Cost of enum-to-string: C++26 reflection vs. the old ways
I completely understand your point. Then again you might be able to use reflection to verify that your manually rolled implementation actually serializes all fields.
gpderetta··on Cost of enum-to-string: C++26 reflection vs. the old ways
The question is whether something belong in the language or in a library (possibly the standard library).

A guiding principle of C++ is that if something can be implemented cleanly and efficiently in a library, the language should not be extended to support the use case.

Now boost.pfr is exceedingly clever, but relying on speculative pack expansions or using stateful metaprogramming hacks is not something I would call clean and efficient, so proper reflection is warranted.

I do worry about the compile time impact though.

gpderetta··on Cost of enum-to-string: C++26 reflection vs. the old ways
The whole point of reflection is that it doesn't have to be builtin.
gpderetta··on Linux gaming is faster because Windows APIs are becoming Linux kernel features
The last time I asked the same question here, user dwattttt finally pointed out[1][2] to me that there is a significant difference: wfmo can actually acquire semaphores in addition to waiting for them, which poll can't do in a non-racy way and efficient way. It can also do rendezvous synchronization (i.e. signal-and-wait).

[1] https://news.ycombinator.com/item?id=47513667 [2] https://lore.kernel.org/lkml/f4cc1a38-1441-62f8-47e4-0c67f5a...

gpderetta··on Starship V3
you do not need an orbital capable launcher to carry an anti-satellite weapons. Modified SAMs are sufficient.
gpderetta··on Extremely Low Frequencies
"The Most Exciting Phrase in Science Is Not ‘Eureka!’ But ‘That’s Funny’"

(often attributed to Isaac Asimov, but origin is uncertain)

gpderetta··on dBase: 1979-2026
I think parent was alluding to mutability.
gpderetta··on Why should a Trace-ID be 128 bits? (A Surprisingly Long Answer)
TL;DR Birthday Paradox.
gpderetta··on Show HN: TRUST – Coding Rust like it's 1989
VisualRust
gpderetta··on GCC 16 has been released
Well, ignoring alignment restrictions, it depends on the implementation of read. If it is truly opaque, as far as the compiler is concerned, the kernel (or the network card or whatever) is truly constructing a Foo in that buffer, making the cast perfectly legitimate.

start_lifetime_as is useful when the buffer lifetime is transparent to the compiler and it can mess up aliasing assumptions.

gpderetta··on GCC 16 has been released
Everybody remembers that specific version :). And I wasn't even programming professionally at that time!
gpderetta··on Germany has become the largest ammunition producer in the world
A good artillery team should be able to fire and scoot before counter-battery fire. And that's supersonic. You won't be able to do counter-battery with current drones. And an hypothetical supersonic drone is not going to be cost effective.

Drones are likely still great to opportunistically picking up artillery that is scouted by other surveillance drones, but it is probably not the best solution for attacking a battery that is currently firing, unless a drone happens to be already in position.

gpderetta··on Magic: The Gathering took me from N2 to Japanese fluency
It seems I chose AI 5 times out of 5. I'm not a native speaker, so I might have preferred a slightly more straightforward text.

On one side, I think this suffers a lot from selection bias: short AI snippets specifically chosen by humans for their quality and they do not necessarily reflect the average experience of AI text. On the other hand, AI generated text does not preclude human editing.

gpderetta··on What async promised and what it delivered
Data race != Race condition
gpderetta··on Over-editing refers to a model modifying code beyond what is necessary
maybe you have a wrong mental model on how compiler works then. I'm not a compiler developer, but usually I have a pretty good idea on what code gcc will generate for my C++: it is far from a black box.

Also compilers usually compose well: you can test snippets of code in isolation and the generated code it will have at least some relation to whatever asm would be generated when the snippet is embedded in a larger code base (even under inter-procedural optimizations or LTO, you can predict and often control how it will affect the generated code).

gpderetta··on Over-editing refers to a model modifying code beyond what is necessary
LLMs are deterministic[1], but the only way to determine the output is to empirically run them. With compilers, both the implementor and a power user understand the specific code transformations they are capable of, so you can predict their output with good accuracy. I.e. LLMs are probably chaotic systems.

edit: there might be a future where we develop robopsychology enough to understand LLM more than black boxes, we we are not there yet.

[1] Aside from injected randomness and parallel scheduling artifacts.

gpderetta··on XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?
And in practice it is very likely that XOR and the variously sized vector ADDs and SUBs are implemented exactly by the same ALU circuitry, parameterized by a bitmasks of the carry lines to enable (none for XOR, all except the vector size boundaries for the vector operations).
gpderetta··on XOR'ing a register with itself is the idiom for zeroing it out. Why not sub?
special mov 0 instruction times 8 registers. The opcode space, especially 1 byte opcode space, is precious so encoding redundant operations is wasteful.
gpderetta··on Laws of Software Engineering
ah, I thought it was an Ubik reference!
gpderetta··on Quantum Computers Are Not a Threat to 128-Bit Symmetric Keys
Interesting, after the mention of inverse Ackerman and spanning trees, I was sure this was going to be Union-Find (i.e. Kruskal's)!
← PreviousPage 5 of 34Next →