Earlier quoted context omitted.
Java Virtual Threads are a superior paradigm to C#'s async/await and function coloring.
I don't get what the big problem is with function coloring. You basically only need async when doing IO, and you had better know when a function does it, or you may have a bad surprise at some point in the future.
.NET (OK, C#) finally gets union types
261–270 of 300 posts
Re: .NET (OK, C#) finally gets union types
#262Earlier quoted context omitted.
> I think operator overloading would be a very bad feature for an enterprise language like Java which needs to be consistent above all else. Operator overloading increases consistency. Instead of having int a = b + c; CustomNumberType x = y.add(z); you have int a = b + c; CustomNumberType x = y + z;
The problem with operator overloading is it makes things confusing when mixing types and let's programmers write confusing code. Person x; Job y; CustomType z = x + y; WTF is Z? Is the argument, anyway, I support operator overloading.
Hopefully a type error, because no sane programmer would implement addition like this. Obviously an insane programmer could, but that’s not the fault of operator overloading. The following code is exactly as confusing:
Person x;
Job y;
CustomType z = add(x, y);Re: .NET (OK, C#) finally gets union types
#263Earlier quoted context omitted.
What I don't get is why Java doesn't get dogged for desktop UI like C# does.
Because Microsoft pushes C#/dotnet as the preferred way to write UI on Windows.
Re: .NET (OK, C#) finally gets union types
#264Earlier quoted context omitted.
Do you think by now C# has left Java behind in features and performance?
C# was always better than Java as a language. The strength of Java is the ecosystem, and Java being open source and cross-platform from the beginning.
Re: .NET (OK, C#) finally gets union types
#265Earlier quoted context omitted.
yeah this is the one I've considered as being mildly compelling. But don't we lose the fun of having exception handling as separate to the happy path?
oo and support for exceptions, in particular checked exceptions, was a mistake of the 90s. We know better today, there’s a reason for why modern languages like go/rust/swift don’t use them, and why many use c++ with exceptions disabled.
Result fn()
T | E fn()
T fn() throws E
fn() throws(E) -> TRe: .NET (OK, C#) finally gets union types
#266Earlier quoted context omitted.
The problem with operator overloading is it makes things confusing when mixing types and let's programmers write confusing code. Person x; Job y; CustomType z = x + y; WTF is Z? Is the argument, anyway, I support operator overloading.
> WTF is Z? Hopefully a type error, because no sane programmer would implement addition like this. Obviously an insane programmer could, but that’s not the fault of operator overloading. The following code is exactly as confusing: Person x; Job y; CustomType z = add(x, y);
Re: .NET (OK, C#) finally gets union types
#267Earlier quoted context omitted.
C# used to be my favorite language, but having spent a lot of time in Rust using its algebraic data types + match statements + Option & Result types, then returning to C# to build a few moderately involved libraries, I'm horrified by the enums and null & error handling that I used to deal with all the time. I knew that enums were really just named integer values and nothing more, but I had forgotten than you can buil…
> I had forgotten than you can build a perfectly legal enum from an integer out of the bounds of the enum's range. And a switch statement is non-exhaustive These are solved by the new feature described in the article that we're commenting on right now. They're giving us unions and exhaustive switch. Ctrl+F "canonical way to work with unions" in the article to see an example. One of the best parts about C# is they nev…
Re: .NET (OK, C#) finally gets union types
#268Re: .NET (OK, C#) finally gets union types
#269Earlier quoted context omitted.
> WTF is Z? Hopefully a type error, because no sane programmer would implement addition like this. Obviously an insane programmer could, but that’s not the fault of operator overloading. The following code is exactly as confusing: Person x; Job y; CustomType z = add(x, y);
I don't know; you can bit shift an output stream by a string (or char array) in C++ (std::cout << "Hello, world!"). That seems pretty mad to me.
Re: .NET (OK, C#) finally gets union types
#270C# is my strongest and favorite language. That said, it's frustrating that the C# framework ecosystem lacks solid options. MAUI is especially half-baked, and I'm really starting to doubt whether I should continue using XAML
Winforms is better than ever. You can use it with .NET10 and WebView2 is a thing now.