Hacker Newsnew | past | comments | ask | show | jobs | submit | horseloverthin's commentslogin

this is quite an interesting result, as some constructive mechanism for showing strong lower bounds on border rank has some severe implications for GCT ( one of the traditional paths to resolving P/NP ), as well as VP/VNP, which Anthropic has a negative result for recently.

> GCT ( one of the traditional paths to resolving P/NP )

GCT: geometric complexity theory; see https://en.wikipedia.org/wiki/Geometric_complexity_theory


Which way do these implications go? I understand that VP != VNP is evidence in favour of P != NP, but what about the matrix multiplication result?

I think some increase in memory-safe outputs is a part of the 'memory safety story' of C++ regardless of whether this comes from type-level changes or improved constructs for memory safety.

Perhaps, a good way to describe the difference here is to clarify that contracts do not innately make C++ as a language more memory safe, but have plenty to do with the memory safety of C++ applications.


Contracts have plenty to do with memory safety; the notion of 'hardened implementations' and bound-checked vector access ( 2 enormously popular features) rely on the contracts model.

Contracts as originally designed by the committee were explicitly not meant to enforce memory safety in that way. You were not supposed to be able to rely on the existence of any particular contract check at runtime. This recent change was something that the committee had rejected earlier, and probably begrudgingly accepted this time around as a compromise to try to ensure the NB vote passes

The two features you list don't have to depend on contracts, and in fact didn't do so at first. The dependency was only added later, and there were efforts to undo such a change right to the end.

Furthermore, IIRC hardening only relies on the contracts system to report precondition violations. The actual checks are intentionally not contract assertions and are intentionally not controlled via the same system as other contract assertions (i.e., hardened checks remain even if you use "ignore" as your contract evaluation semantic).


The reason for this is that C++ has, by design, avoided the use of runtime checks. But I think this is ill advised from now on, as we need to enforce safety behaviors beyond what the type system can do.

Assertions were always an option. Unless I'm missing some new development, contracts are just a new way to spell assertions. That's good, but it doesn't move the needle at all in terms of memory safety.

making memory safe patterns easier to implement makes for more memory safety:)

A good way to think about contracts and related features as they relate to memory safety is from the compilers perspective; pretty much any feature that gives the compiler additional information about a users intent for a scope allows the compiler to have to infer less, and thus have more ability to provide 'safety' guarantees.

The most trivial example of this is a check that a caller has provided non-null inputs ( hence allowing 'safe' unchecked access in most cases)


> A good way to think about contracts and related features as they relate to memory safety is from the compilers perspective; pretty much any feature that gives the compiler additional information about a users intent for a scope allows the compiler to have to infer less, and thus have more ability to provide 'safety' guarantees.

Except this isn't true, and it's at best an unfounded belief that relies on hand waving and wishful thinking to connect how an optional debugging tool that affects memory allocation and is able to throw exceptions will save anyone from things such as use-after-free.


If you're going to rewrite a bunch of C++ to add contracts to assert that your pointer arguments are non-null ... you could, I don't know, just use references instead, the exact construct we have had for decades to express this. If you're cargo-culting the GSG so much you're unwilling to use references appropriately I seriously doubt you are also going to replace whatever existing "pointer argument x is non-null" checks you use with a brand-new contracts mechanism.

There are many common places where this pointer case comes up and using references is simply not an option ( i.e plugin/FFI boundaries, dlsym callbacks, externed C). You will have a very bad time doing any systems programming, for example, if you live by the dogma of shaking your fist at raw pointers and saying use refs instead!

Perhaps for a more familiar case where contracts allow greater memory safety: constexpr T& operator[](size_t i) const pre(i < size()); constexpr T& front() const pre(!empty());

or even more commonly: void register_handler(std::unique_ptr<Handler> h) pre(h != nullptr);


Yes, I am distinctly over-simplifying things. There certainly are cases where pointers are appropriate, but I suspect anyone doing this responsibly already has the necessary non-null checks idiomatic to their codebase, and I am very dubious that anyone doing so irresponsibly is going to jump straight to contracts. I only mention the GSG because in the codebases I regularly deal with my experience is that the overwhelming majority of non-nullable pointer arguments appear in cases that adherence to the GSG has created, rather than cases where it is actually necessary for the API.

References hide important semantic information:

    int x = 1;
    foo(x);  
    // What values has x?
In C the answer is obvious, in C++ due to the existence of references and the poor way they are designed, it is not anymore.

What's wrong with checking the signature of foo to see what it does?

Having to check in the first place.

I understand that doing a mouse over in the IDE is something too advanced. /s

There is a huge different between having to actively explore all variables to find out what is behind them to simple looking at the code.

Yeah, that is what happens when one eschews modern IDE tooling, more work for easy stuff.

No, sorry, this has nothing to do with tooling. I do not want to move my mouse over all variables and read the fine print before being able to reason about the code.

Except for any codebase of meaningful complexity you end up with functions that mix value and pointer variables, and whatever "obvious" signal you get out of the simple cases disappears into the noise. At the end of the day there is no replacement for understanding the signature and behavior of the function that is being called.

Considering that every other "C family" language community gets by just fine with call sites that look like using references, I think calling this element of references "poorly designed" is quite a stretch.


Specially coming from a language that after 50 years still doesn't have slices to fix their strings and arrays, something that Dennis Ritchie proposed when he still cared about the standard.

I use slices in C, I just have to define them myself.

Yeah, what a great solution, I can also use slices in Assembly, one just needs a proper macro processor like MASM and TASM from the 1990s.

yes, and if you assembly this is fine solution. Also there is no fundamental reason C++'s library types using templates are better to macros. The mechanism is basically the same.

References are not a magical spell that guarantees a pointer is non-null. While they help avoid this, because of the way C++ behaves it may result in a null object as well, so a run-time check is still needed.

What references avoid is the unnecessary addition of nullability, not nullability at the source. They also convey that non-nullability to the compiler and user of your API directly, rather than hoping that point-of-use null checks convey the same thing. You still need null checks if you have nullable items, but better to localize those checks specifically where needed than scatter them across your codebase.

Amusingly, the Chromium folks found this out firsthand when working on Rust bindings - all of the unnecessary pointer arguments due to the GSG complicated the process.


> While they help avoid this, because of the way C++ behaves it may result in a null object as well, so a run-time check is still needed.

I think the difference is that with references you can only perform such a check before you create the reference. Pretty sure optimizers can and will elide checks for null references.


> I think the difference is that with references you can only perform such a check before you create the reference. Pretty sure optimizers can and will elide checks for null references.

As someone who had the displeasure of maintaining a decades-old legacy project that had references initialized and assigned with NULL, I don't agree.


Do you mind elaborating? Modern compilers will definitely optimize out checks for null references [0] (but probably aren't guaranteed to), so checking after the fact seems like an iffy proposition to me at best.

[0]: https://cpp.godbolt.org/z/6ze9ns7cz

    bool pointer(int* p) {
        return p == nullptr;
    }

    bool reference(int& r) {
        return &r == nullptr;
    }
Become

    pointer(int*):
            test    rdi, rdi
            sete    al
            ret

    reference(int&):
            xor     eax, eax
            ret
When compiled with Clang 23.1.0 and -O1.

I read the quote as "I have old code filled with bugs and UB. Using references don't magically solve the bugs"

In that case I think I'd agree that references are not a silver bullet, especially with modern optimizing compilers.

I think that its likely the reason for a) the strange naming scheme b) the promptness between releases is that google has outpaced internal expectations for model development ( probably due to RSI ) and now can now utilize its vast compute pool much more effectively for autoresearch and exploratory self-improvement tasks. I wonder if this suggests a steeper trajectory for them than OAI/Anthropic in general.

Assuming no implicit phacking a 15 point jump on tbench scientific is a big deal.

I suspect we will see people being adamant that this model simply 'feels' better due to long horizon goal alignment improvements ( like this kind that would cause this jump)


formal algorithms for transformers provides perhaps the most succinct introduction to attention I can imagine https://arxiv.org/pdf/2207.09238


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: