News for hackers. Stuff that matters.
Re:.NET 6 vs .NET 5 speedup by chrisoverzero on Sunday November 21, 2021 @09:30AM (#29296402)
> the new-idiomatic .netcore and later style

`Int32.TryParse` has existed since .NET Framework 2.0, which was released on February 13, 2002: https://docs.microsoft.com/en-us/dotnet/api/system.int32.try...

Re:.NET 6 vs .NET 5 speedup by rndgermandude on Sunday November 21, 2021 @09:36AM (#29296435)
Right, this one has, a lot of other public or runtime-internal Try* methods have not.

And even tho this particular one has existed for a long time, that doesn't mean it was used consistently in the runtime or in the popular first and third party frameworks.

I'd argue the Try*-style, while artifacts of it were present before already, only really became widely idiomatic with dotnetcore.

Re:.NET 6 vs .NET 5 speedup by cyral on Sunday November 21, 2021 @02:17PM (#29298868)
Surprising that in 2021 Java still doesn't have this in its standard library
Re:.NET 6 vs .NET 5 speedup by native_samples on Monday November 22, 2021 @05:30AM (#29304906)
Well, the Java approach is philosophically somewhat different. C#/.NET is closer to C++ where they are very willing to complicate the language and APIs to make the job of the runtime or compiler easier. Java just philosophically refuses to do that, more or less (perhaps you could argue that's changing a bit now with value types).

So in Java they just made exceptions really fast. There are lots of runtime optimizations around exceptions, for example, if you regularly parse strings that aren't numbers then the resulting exception will automatically stop having its stack trace filled out, which makes throwing drastically cheaper. The JVM can also inline the code and then convert try/catches to ordinary gotos.