Re:The search for easier safe systems programming
by pjmlp on Wednesday May 08, 2024 @11:05AM
(#40298901)
Unity 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.
Re:The search for easier safe systems programming
by dartos on Wednesday May 08, 2024 @10:50PM
(#40304829)
Callable 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.
Re:The search for easier safe systems programming
by neonsunset on Thursday May 09, 2024 @01:44AM
(#40305607)
You didn’t. The example does not exist and the terms you used don’t apply to C#.
Post an actual example (code).
Re:The search for easier safe systems programming
by dartos on Friday May 10, 2024 @08:27AM
(#40318158)
Delegate is a C# term and was what I was talking about
https://learn.microsoft.com/en-us/dotnet/csharp/programming-...
I need to create a delegate for any function I want to pass around.
Re:The search for easier safe systems programming
by neonsunset on Friday May 10, 2024 @09:04AM
(#40318505)
Trolling 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());
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)