Earlier quoted context omitted.
but can you define T1 and T2 of string, then use Either ?
Could you be clearer about what you mean, since string is a sealed type in C#, so what exactly do you mean T1 and T2 of string?
.NET (OK, C#) finally gets union types
61–70 of 300 posts
Re: .NET (OK, C#) finally gets union types
#62I mean yes, but also: uh-oh. I'm looking forward to reading some code that is even more confusing than the code I'm already reading. Not entirely convinced that I see the usecase that makes up for the potential madness.
This is a classic debate in programming, literally: 2001: "Beating the Averages" (Paul Graham) [1] 2006: "Can Your Programming Language Do This?" (Joel Spolsky) [2] Both of these articles argue for the thesis that programmers that have been deprived of certain language features often argue that they don't need those features since they are already comfortable working around the lack of said features. It's a fancy way…
Re: .NET (OK, C#) finally gets union types
#63Earlier quoted context omitted.
Simple example: type Expr = | Primitive of int | Addition of (Expr * Expr) | Subtraction of (Expr * Expr) | Negation of Expr
Isn't that just Func ?
Re: .NET (OK, C#) finally gets union types
#64F# leads the way and C# slowly catches up, as always. Yet for some reason, C# still gets all the mindshare.
What types of problems are better solved in F# than C#? Is having a combination of F# and C# in a single codebase possible? Is it recommended?
And yes, you can combine them, but afair, only in terms project boundaries. (You can include a c# project in an f# one and vice versa). There are a few cases where it's quite useful. For example, rewriting a part of a big project in f# to leverage the imperative shell - functional core architecture. Like rewriting some part that does data processing in f#, so that you can test it easier/be more confident in correctness, while not doing a complete rewrite at once.
Sort of like rust parts in the linux kernel.
Re: .NET (OK, C#) finally gets union types
#65Re: .NET (OK, C#) finally gets union types
#66Re: .NET (OK, C#) finally gets union types
#67Earlier quoted context omitted.
This is a classic debate in programming, literally: 2001: "Beating the Averages" (Paul Graham) [1] 2006: "Can Your Programming Language Do This?" (Joel Spolsky) [2] Both of these articles argue for the thesis that programmers that have been deprived of certain language features often argue that they don't need those features since they are already comfortable working around the lack of said features. It's a fancy way…
I can already do functional programming like map/reduce in C# tho. Not sure what the LISP argument is. Spolsky was saying there's a perf benefit in there somewhere but I'm not seeing how unions give me that.
1. Argue from ignorance. Never try unions in any other programming languages and completely disallow their use in C# codebases that you participate in.
2. Try them out and adopt an informed opinion.
You may even choose to remain in ignorance until someone wastes their own time trying to convince you. But it isn't my job or desire to teach someone who won't put in the effort to learn for themselves.
Re: .NET (OK, C#) finally gets union types
#68C# 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
Re: .NET (OK, C#) finally gets union types
#69C# 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, wpf, blazor, maui, avalonia, what are you talking about
Re: .NET (OK, C#) finally gets union types
#70C# 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, wpf, blazor, maui, avalonia, what are you talking about