Yuck. I like both Go and C# a lot, and use them both professionally. In my experience the strengths of Go are mostly - Deployability via single-file static binaries - Simple syntax that anyone can learn (no exceptions, no classes or inheritance) - Wicked fast compile times And the strengths of C# are - Powerful language with null-safety and lots of syntax sugar - Runtime-level coroutines so you don't need `async/awai…
C# is a pretty bad language when you take away the stack it sits atop of. I do mostly like the async but developers put up with a lot of shit to e.g. use the msft networking stack and containers
G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
81–90 of 107 posts
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#82Earlier quoted context omitted.
Reflection, is one thing. It's a common misconception, somehow. Reflection works in AOT.
It works through the new UnsafeAccessorAttribute [1]. This provides the information needed for AOT to know what needs to be in the final binary and not trimmed. It also removes the lookup overhead associated with normal reflection which is very nice. [1] https://learn.microsoft.com/en-us/dotnet/api/system.runtime....
This works perfectly fine with AoT:
var writeLine = typeof(Console).GetMethod("WriteLine", [typeof(string)]);
writeLine.Invoke(null, ["Hello world"]);
As you can see, there are no UnsafeAccessorAttribute's. Plain old reflection that just works (why should it not?)Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#83Earlier quoted context omitted.
C# is a pretty bad language when you take away the stack it sits atop of. I do mostly like the async but developers put up with a lot of shit to e.g. use the msft networking stack and containers
Care to elaborate on what would make C# a bad language?
They have in fairness fixed a lot of the worst aspects of this by adding basically a second language to it but e.g. I massively prefer writing F# if purely because if I want to do something I can just to it rather than first implementing public static DoThing : IDoThing
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#84Yuck. I like both Go and C# a lot, and use them both professionally. In my experience the strengths of Go are mostly - Deployability via single-file static binaries - Simple syntax that anyone can learn (no exceptions, no classes or inheritance) - Wicked fast compile times And the strengths of C# are - Powerful language with null-safety and lots of syntax sugar - Runtime-level coroutines so you don't need `async/awai…
C# has single-file static binaries
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#85So... the verbosity of Go without the compile speed of Go? Go is not a language I would associate with ergonomics, and this doesn't even have most of modern C#'s best features: does xUnit.NET work? Does immutable records work? Do collection expressions work? Does LINQ work? Calling a language with `let` instead of `const` and async/await and iterators and classes "Go" is plain just incorrect. This G# is more similar…
I don't find Go especially verbose - in fact, due to the economy of syntax, Go code without the usual syntax sugar features ends up similar in length to other curly brace languages. I tested this with C# and Typescript, where I migrated projects from these languages to Go - the overall volume of code stayed roughly the same.
err := do_something()
if (err != nil) {
return nil, err
}
err = do_something_else()
if (err != nil) {
return nil, err
}
err = do_something_more()
if (err != nil) {
return nil, err
}
...So very concise. And this is not even including the error wrapping that is recommended.
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#86Earlier quoted context omitted.
modern C#'s best features: does xUnit.NET work? Does immutable records work? Do collection expressions work? Does LINQ work? xUnit and LINQ are not C# features, why should they not work in another .NET language?
Micro$oft's wiki: > Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language.
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#87Earlier quoted context omitted.
Care to elaborate on what would make C# a bad language?
It's a product of an era of OOP when the idea of a program fitting in a developers head was a dangerous reactionary idea. They have in fairness fixed a lot of the worst aspects of this by adding basically a second language to it but e.g. I massively prefer writing F# if purely because if I want to do something I can just to it rather than first implementing public static DoThing : IDoThing
public static DoThing : IDoThing
Yeah... Right.In other words, C# is a bad language because you don't like it?
What does prevent you from "just do it" in C# without extra classes and interfaces?
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#88Earlier quoted context omitted.
AOT is entirely independent of single file binaries. And self-contained binaries that run without the framework installed are again a separate concept. There are some dependencies between these, but they are not the same thing. AOT is not all that useful yet for many applications as important libraries still don't support it. So more something for things like CLI tools with a small scope. It's not quite the same as w…
> AOT is entirely independent of single file binaries. splitting hairs, but its is not independent. AoT is a required pre-requisite for single-binary creation. You can't create single-binaries with JIT. And that is the big hurdle, lot of libraries do not support AoT and that is the blocker to create single-file binary. Once you have the AoT figured out, the single-binary creation is easy.
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#89Earlier quoted context omitted.
modern C#'s best features: does xUnit.NET work? Does immutable records work? Do collection expressions work? Does LINQ work? xUnit and LINQ are not C# features, why should they not work in another .NET language?
Micro$oft's wiki: > Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language.
Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics
#90So... the verbosity of Go without the compile speed of Go? Go is not a language I would associate with ergonomics, and this doesn't even have most of modern C#'s best features: does xUnit.NET work? Does immutable records work? Do collection expressions work? Does LINQ work? Calling a language with `let` instead of `const` and async/await and iterators and classes "Go" is plain just incorrect. This G# is more similar…