3 ms·
Are you sure you are talking about C# and not some other language? There is no such thing in C# as "callables". It has lambdas, Funcs and delegates. It has alw
by neonsunset 2y ago
Are you sure you are talking about C# and not some other language? There is no such thing in C# as "callables". It has lambdas, Funcs and delegates.
It has always had a fair share of FP features and only gained more as it kept evolving. It had higher order functions partially in the form of method group to delegates conversions since C# 2.0, released 19 years ago and to a full extent in the form of lambda expressions since C# 3.0, which also included LINQ, released 17 years ago. It is a mixed-paradigm language.
On the off chance that this is trolling, I must point out that Java and C# are sufficiently distinct, with the latter leaning more heavily on offering both lower and higher level features like extensive pattern matching, LINQ, structs and pointers/byrefs.
If you do have C# snippets you are unhappy with - please post them. There is likely a better way.
(I noticed you posted about Callables twice, and had a quick search - it appears to be a Godot-specific abstraction imposed on C# due to inadequacy of GDScript it has to interoperate with, and has nothing to do with C# itself)
- pjmlp 2y agoUnity and Godot are both a bless and a sin for C#'s adoption. In one way, they help the adoption in the games industry, in the other hand they introduce so many anti-patterns with their reflection based SDKs, and use of magical methods instead of proper .NET code.
- dartos 2y agoCallable may have been the wrong word. I think I meant delegate. (I do work with Godot, but not in C#. Some wires must’ve gotten crossed) Regardless of the actual word, there is an extra thing I need to do to pass a function to a higher order function as an argument. I was using this as an example to demonstrate how C#’s support for the language features I like require some ceremony which reduce expressiveness and require me to think about the language more.
- neonsunset 2y agoYou didn’t. The example does not exist and the terms you used don’t apply to C#. Post an actual example (code).
- dartos 2y agoDelegate is a C# term and was what I was talking about https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/delegates/ https://learn.microsoft.com/en-us/dotnet/csharp/programming-... I need to create a delegate for any function I want to pass around.
- neonsunset 2y agoTrolling is bad, consider asking ChatGPT or reading documentation first, thanks. var func1 = (int i) => i + i; var func2 = () => func1(1) * 2; Console.WriteLine(func1(4) + func2());