Live data from Hacker News

G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

davidobando.github.io

81–90 of 107 posts

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#81
post #78
post #21

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

I feel the opposite. It is one of the genuinely competent languages out there, if you're the kind of person that isn't upset about it being a "kitchen sink". Instead, I feel like the ecosystem, community and reputation hold it back. There are nowhere as many useful and popular packages to reach for as Python for example. Unity3D always lags behind in runtime and language version and had amazingly bad package management -- this further hamstrung C#, because the language is never used in a vacuum.

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#82
post #65

Earlier 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 attribute makes the compiler generate IL code as if the target member was accessible to the user code. It's orthogonal to AoT and reflection.

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?)

https://godbolt.org/z/Yv8hadYqv

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#83
post #78

Earlier 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?

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

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#84
post #21

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# has single-file static binaries

Yes but no. It's essentially a self-extracting executable, so adds significant start-up time. It also doesn't work in all cases, for example the database driver files to the DB we use aren't compatible with the single-file deployment method.

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#85

So... 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

#86
post #77
post #71

Earlier 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.

Generally when people say LINQ they're referring to the IEnumerable/IQueryable APIs in the BCL, not to C#'s little-used query syntax.

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#87
post #83

Earlier 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

#88

Earlier 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.

Other way around, enabling AoT requires you also enable single-file

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#89
post #77
post #71

Earlier 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.

[deleted]

Re: G# – A modern .NET language with Go, Kotlin, and Swift ergonomics

#90

So... 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…

https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

they're coming

Post reply on HN