If they really need to guard the thinking output, they could encrypt it and store it client side. Later it'd be sent back and decrypted on their server.
But they used to return thinking output directly in the API, and that was _the_ reason I liked Claude over OpenAI's reasoning models.
Woah, that's quite an issue. The equivalent code in Python doesn't typecheck, since `list` is invariant and hence list[str] doesn't fit list[str|int]. Unusual for TS to handle types worse than Python.
Very interesting. I’m shocked the typescript creators built a system with this failure mode. I guess the solution here is to have tsc change the type of “a” after the call to mutateArray, unless the arr argument is marked as readonly.
I think the problem is the union argument type - intuitively we read "array of strings OR numbers", but actually it means "array of strings AND numbers". Probably generics would be more appropriate here, with the type param constrained to string or number. Then tsc would also complain about pushing a number without checking the item type before.
That would be the sound way to do things, but it's also surprisingly common for arrays for some reason. It also doesn't get checked compile time in Java, although it does throw an exception because the arrays are type-enforced at runtime at least.
This compiles fine:
class A {}
class B1 extends A {}
class B2 extends A {}
public class MyClass {
public static void main(String args[]) {
A[] array = new B1[1];
array[0] = new B2();
}
}
That's because it's structurally typed (as opposed to nominally typed). I don't happen to prefer it, but I don't think it's fair to conflate that with unsoundness like the example given above; it's totally possible to have a sound structural type system. TypeScript doesn't happen to be sound, but it's not because of that.
In TypeScript it's called "bivariance", which sounds very programming language theory like, but is not a term typically used in academic contexts, since it is unsound almost by default. It's described here: https://www.typescriptlang.org/docs/handbook/type-compatibil...
"allowing this enables many common JavaScript patterns"
Honestly at this point they should make a new strict "no js" mode, as the ecosystem likely has reached a tipping point where you can get by without mixing typed and untyped js at compile time. Wonder if targeting wasm directly would help ensure those boundaries are ensured...
I asked an LLM and it described the problem as "covariant typing of mutable collections" or "unsound covariance". I'm not mathematically educated in this area but that sounds right?
Yes, that's correct. If you're curious for a slightly more concrete source, Wikipedia covers this reasonably well (although citing one often decried source to validate another might not be particularly convincing to some people): https://en.wikipedia.org/wiki/Type_variance#Arrays
Yikes. I've only been using ts for about a year, I had no idea this was considered a "valid" case. Seems like a type error to me. I wonder how they justify this?
I agree with this take. Desktop Linux is better than ever and I can do just about 100% of what I need on my Linux PC. I still use macOS regularly and even Windows sometimes, but I’m not too worried about Apple or Microsoft locking things down. The more they do, the more I’ll just use Fedora where the same apps I need are available.
The most critical apps for me on mobile are banking, payments, transportation, and messaging. Banking I can’t do much about. Payments I can still handle with physical cards. Messaging is getting better thanks to people adapting proprietary services to Matrix, so with some effort you can use one open source client to reach them all.
Transportation is the area I’ve been working on. I’ve been getting MapLibre (an open source map rendering library) running on Compose Multiplatform, including Compose Desktop (so map apps built in Jetpack Compose could extend to Linux based phones like Librem) and also on Huawei’s HarmonyOS. If I can cover my everyday needs with open tools, then walking away from the Google/Apple duopoly stops being a thought experiment and starts being a real option for me.
It depends on exactly which car you are comparing. The Tesla Model 3 is somewhere around 3500 lbs, isn't it? That's pretty average for a car these days.
And there are plenty of big SUVs that have a similar weight to the heavier EVs.
Besides, you can't assume that electric cars use the same tires as non-electric ones.
There is a huge range of tires out there from extremely long wearing ones to sticky ones that last a fraction of the time.
But they used to return thinking output directly in the API, and that was _the_ reason I liked Claude over OpenAI's reasoning models.