News for hackers. Stuff that matters.
Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @08:13AM (#40297119)
C# offers multiple options for abstracting away functionality. What do you have in mind?

Also, JVM ecosystem does not offer the ability to provide zero-cost abstractions, which C# does with monomorphized generics. This is a hard requirement for productive systems programming if you don't want the C level of verbosity.

Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @08:21AM (#40297193)
> Also, JVM ecosystem does not offer the ability to provide zero-cost abstractions

This is true, wasn’t thinking about that.

C# always requires me to use and organize my code into classes and my data into objects.

For example, If I wanted to use higher order functions, I need to wrap functions in callables (Objects).

If I wanted to throw together a quick script to test, I need to set up a program which uses some magic configurations so that I don’t need that entry point class.

Granted I only worked with C# professionally for a couple of years before getting back to a Go shop, but it always felt like trying to avoid thinking in objects was fighting against the language.

Personally, I like just having first class functions which take simple data structures as arguments. Modeling the world as objects just isn’t as clear to me (the old OOP vs FP discussions)

Languages like C# and Java turn me off for that reason.

Re:The search for easier safe systems programming by prmph on Wednesday May 08, 2024 @08:50AM (#40297538)
Exactly.

I used C# for a long time, and when I started using JS, I marveled at the directness of its expressiveness, its lack of ceremony.

What's actually needed is a language as direct as JS, with the bad parts stripped out, types and a proper standard lib added, and compiled to byte-code for performance.

They can call it a different name if they want.

Re:The search for easier safe systems programming by dartos on Wednesday May 08, 2024 @09:30AM (#40297908)
Yeah that “directness” you’re talking about is what I call “expressiveness”

It’s important for how I like to code.

Re:The search for easier safe systems programming by benji-york on Wednesday May 08, 2024 @02:10PM (#40301222)
You might like AssemblyScript (https://www.assemblyscript.org/)
Re:The search for easier safe systems programming by neonsunset on Wednesday May 08, 2024 @09:56AM (#40298172)
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)

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());
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @09:25AM (#40297869)
Valhala might help there, but yeah, we are still a couple of years away and currently the best is to manually model memory with the new Panama API, definitly not the same league as C# / .NET today, which I consider the closest modern language to what Modula-3 has promised us.
Re:The search for easier safe systems programming by fuzztester on Wednesday May 08, 2024 @09:43AM (#40298034)
In what ways is C# the closest to Modula-3's promises?
Re:The search for easier safe systems programming by pjmlp on Wednesday May 08, 2024 @10:05AM (#40298271)
Now that AOT is part of the standard toolchain, with plenty of Midori, and C++/CLI capabilities also exposed to C# Language level, a memory safe systems language with a modern type system.

I would also place D and Swift into that bucket, only D never managed to really take off when it had the opportunity, and Swift is clearly at home in iDevices.

Re:The search for easier safe systems programming by fuzztester on Wednesday May 08, 2024 @10:31AM (#40298540)
Thanks.