Live data from Hacker News

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

davidobando.github.io

91–100 of 107 posts

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

#91
post #74
post #69

Earlier quoted context omitted.

F# is nice, i like it.

Interesting, I have been skeptical about .net as a platform, is it really open and doesn't lock you with microsoft in any way?

.NET is Open Source (MIT) but Microsoft is a major - it's probably safe to say the largest - contributor.

Maybe similar to OpenJDK and Oracle?

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

#92
post #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

Yeah, I still don't understand why they don't just use enums and have to invent a special "union" keyword instead. C#'s enums are extremely underpowered to begin with and the syntax they designed here way more convoluted and uglier to say:

    enum Pet { 
    Cat,
    Dog,
    Bird
    }

    var description = Pet switch
    {
        Dog d => d.Name,
        Cat c => c.Name,
        Bird b => b.Name,
        _ => "no pet"
    }
The other issue is they introduced `null` to pattern matching on their union example when the whole point of pattern matching is that you can pretty much mostly remove `null` from the language altogether with Result available, as Rust has shown.

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

#93
post #90

Earlier quoted context omitted.

https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... they're coming

Yeah, I still don't understand why they don't just use enums and have to invent a special "union" keyword instead. C#'s enums are extremely underpowered to begin with and the syntax they designed here way more convoluted and uglier to say: enum Pet { Cat, Dog, Bird } var description = Pet switch { Dog d => d.Name, Cat c => c.Name, Bird b => b.Name, _ => "no pet" } The other issue is they introduced `null` to pattern…

It sounds like they didn't reuse the enum keyword for this for the most backwards compatibility and to avoid confusion. Your example enum is an `int` today. Either you break existing code expecting an `int` sized thing or you need additional syntax and can't use the "clean" form that you are hoping for.

The null patterns predate these unions and the relevant section of the documentation is showing that you can use nullable unions, not that you have to or should use them. Other examples also show a fully closed Result type that yeah would be great for projects hoping to eliminate more nullable code.

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

#94
post #9

How is this different than C#? What new concepts does this bring that C# doesn't? 20 years ago there was some momentum behind Visual Basic .Net; but the language was so similar to C# that it just wasn't worth using. There was a joke that .Net was a "skinnable language." BTW, there's a whole nitpicky/semantic argument that C# isn't null safe because of the null forgiving operator. That will probably come into play wit…

The momentum behind VB.NET was mainly because most enterprises using VB6 assumed it was the natural replacement.

To be fair, VB.NET itself also thought itself the natural replacement/direct continuation. Its compiler version started at 7.

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

#95
post #16

Earlier quoted context omitted.

What's missing in .NET AOT?

That’s a dishonest question, take any code base >10000 slices, it will not work with aot ootb. Read the docs of what’s missing, if you are honestly interested in what’s missing. https://learn.microsoft.com/en-us/dotnet/core/deploying/nati... Reflection, is one thing. Of course some runtime stuff are missing, but the problem is that no one is using source generators before trying out aot, so as soon you try aot you ju…

The JSON source generators are quite good, and a small performance boost worth considering even when not planning for AOT. The logging and RegEx source generators aren't even for AOT but for improving debugging tools [1] and performance.

Everyone should be exploring source generators already whether or not they expect to try out AOT.

[1] Debugging source generated RegExes is a dream, including being able to breakpoint inside a RegEx in the .g.cs file should you need to trying to get a tricky RegEx right. The code generated by the RegEx Source Generator is incredibly readable and includes great comments that explain what the RegEx does, step by step. Those comments show up as documentation comments on the partial .cs file side once the file is generated and can be used to double check that the RegEx you wrote matches what you expect it to do as you write/update the RegEx and the source gets regenerated (which happens pretty fast).

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

#96
post #91
post #74

Earlier quoted context omitted.

Interesting, I have been skeptical about .net as a platform, is it really open and doesn't lock you with microsoft in any way?

.NET is Open Source (MIT) but Microsoft is a major - it's probably safe to say the largest - contributor. Maybe similar to OpenJDK and Oracle?

Potentially viewable as better than OpenJDK and Oracle (and OracleJDK) from what I've seen. A lot of .NET governance moved to the Dotnet Foundation which is built along the lines of things like the Linux Foundation. Microsoft is the major contributor to .NET and a major sponsor of the Dotnet Foundation, but most of their contributions are still flow through the Foundation legal/governance structure and subject to the same governance as anyone else today. .NET is almost entirely planned and developed openly on GitHub including things like meeting minutes for all in person meetings.

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

#97

Earlier quoted context omitted.

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.

First, this is legal:

       if err := do_something() ;err != nil {
         return nil, err
       }
Not horrible imo. But I've found that verbose error handling and explicit errors made me consider which parts of the code can return err, and reorganize code around that - with that I've been able to eliminate most 'err' from my codebase.

Like, if you go by function: ReadData(has err)-> ParseData(has err) -> ProcessData(no err)

Instead of having functions that can fail dynamically all over your codebase.

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

#98
post #87
post #83

Earlier quoted context omitted.

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?

The noun to verb ratio is too high. This is a normative statement but it's one I'm willing to make that you apparently can't detect.

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

#99

- stupid question: how do you make a programming language like this from scratch? - what is the thought process that goes into making a programming language - what is this field of study or discipline called? - why do we have so many programming languages? what purpose do they intend to solve and how do we know what purpose a programming language was made for? - for example, why was swift made if objective c exists a…

i have made a language that xompiles to c#. I wrote a lexer. then a parser. then a type checker (hindley milner, function local so that top level functions must have type signatures) a match compiler.

the hardest part was what came next: the code generation. despite producing c# instead of MSIL. The features I use are: static and dynamic traits, pattern matching, and a concurrentML.

It is actually quite simple when you don't have to do closure conversion yourself.

Post reply on HN