News for hackers. Stuff that matters.
Re:Update to the .NET Language Strategy by zengid on Wednesday February 08, 2023 @06:46PM (#34717457)
Hot take but I wish they’d start a new lang in the spirit of what’s happening in swift/Kotlin instead of evolving C#. I use it everyday. I love the new pattern matching, it simplifies a lot of gnarly reflective type checks and feels good. Records are nice too. I see discriminant unions are coming soon. But they’re painting themselves into the corner in terms of syntax and overcoming OOP defaults. A fresh start would be incredibly expensive and risky, but it would bring in a lot of excitement and fresh faces. /rant
Re:Update to the .NET Language Strategy by Arnavion on Wednesday February 08, 2023 @06:52PM (#34717529)
.Net itself is fundamentally OOP. Lambdas are implemented as classes with an Invoke method, F# enums are implemented as classes with variants as subclasses, etc. So if "overcoming OOP defaults" is the goal then making a new .Net lang that isn't OOP doesn't achieve much.

So it would have to be either be a new native language, or a new managed language that also comes with a whole new managed runtime. For the former, Rust is already satisfying that need within Microsoft. For the latter, there's even less demand both inside and outside.

Re:Update to the .NET Language Strategy by zengid on Wednesday February 08, 2023 @07:01PM (#34717624)
Yeah I argree, making a new lang for a vm runtime doesn’t make as much sense when rust is right there, because the vm itself has a lot of baggage and limitations (OOP baked in, start up time,etc). The dotnet team seems to be moving mountains to squeeze more performance out of the VM, which is awesome, but how much further can it go?
Re:Update to the .NET Language Strategy by andsoitis on Thursday February 09, 2023 @05:33AM (#34722019)
productivity on the CLR and JVM is light years ahead of that in Rust. Rust has its niche, but it isn’t superior to broad surface that the managed runtimes provide leverage for.
Re:Update to the .NET Language Strategy by BenGosub on Wednesday February 08, 2023 @07:07PM (#34717689)
How come classes are being used in a functional language?
Re:Update to the .NET Language Strategy by layer8 on Wednesday February 08, 2023 @07:33PM (#34717948)
Closures and objects are very similar: a bunch of data with associated code that you can call.

See also https://wiki.c2.com/?ClosuresAndObjectsAreEquivalent.

Re:Update to the .NET Language Strategy by mastax on Wednesday February 08, 2023 @07:54PM (#34718175)
Classes are part of the .NET intermediate representation (CIL) that the compilers emit and that the virtual machine executes. OOP is baked in at a low level.
Re:Update to the .NET Language Strategy by javcasas on Thursday February 09, 2023 @04:20AM (#34721521)
You know we used to call it Microsoft Java, right?

I mean, going beyond the sarcasm, ultimately C# copied most (if not all) the Java design decisions:

* OOP baked in (more like hardcoded into the execution model)

* Heavyweight VM that needs to be installed apart, that tries to achieve better performance by using way more resources (runtime/VM that needs to recompile the code multiple times instead of ahead of time compilation)

* 1 main OOP language, a few second class citizen languages

* Claim to be 1 stop shop for all development needs, falls short by pretending all development needs outside what it covers to be invalid/inferior

* Sold to managers as the magic way to have cheap replaceable developers

Re:Update to the .NET Language Strategy by hardware2win on Thursday February 09, 2023 @05:22AM (#34721957)
Boring comparison tbh.

VM doesnt have to be installed, you can deploy the single file app with it + there is AOT too

Btw. C# has reified generics

Re:Update to the .NET Language Strategy by javcasas on Thursday February 09, 2023 @05:54AM (#34722184)
Wow! Big differences!

Ocaml has a VM which is included by default (70kb), and can also compile to native (skip the VM altogether). It has been like that since at least 2002 (the first time I checked it, probably before that).

Haskell has HKT, which generalize generics.

Java and C# share 95% ideas in comparison to stuff outside Java/C#. That's why the comparison is boring: there is very little to compare.

Re:Update to the .NET Language Strategy by hardware2win on Thursday February 09, 2023 @06:27AM (#34722397)
So we went from Java vs C# to C# vs the world? I see where this is going, anyway

Another differences

Approach to async

Approach to ecosystem fragmentation

Approach to GCs

In general people would argue that C# > Java, but JVM > CLR

Re:Update to the .NET Language Strategy by javcasas on Thursday February 09, 2023 @07:25AM (#34722934)
Now we are startung to talk serious.

Yes, I'd like Java's ability to use and tune different GCs to be available in other places.

Async is pretty much the colored vs non-colored function discussion, for which there are good arguments on both sides.

Related to C# being better than Java, I think it is, but not in a significant way. If Java uses 100% boilerplate, C# uses around 90% boilerplate. An improvement indeed, but way more progress can be achieved. And then C# has some questionable features (extension methods: methods for a class but that are not part of the class code).

Related to VMs, JVM may be better than CLR, but again both of them have an unacceptable footprint because you have to educate the final user on managing the internals of your application (yay I have to install, update and be wary of exploits for the Java Runtime/.net redistributable, and then different versions are subtly incompatible, so to use program X I have to uninstall the version I use for program Y).

Re:Update to the .NET Language Strategy by hardware2win on Thursday February 09, 2023 @08:14AM (#34723441)
>And then C# has some questionable features (extension methods: methods for a class but that are not part of the class code).

I dont think people share this opinion.

Extension methods are very handy and powerful while being simple and you can see how similar vision works well in Rust: impl trait for type

It allows e.g library makers to create strong small core and users/community to create their wrappers/integrations easily

Re:Update to the .NET Language Strategy by javcasas on Thursday February 09, 2023 @09:40AM (#34724569)
Extension methods are "I want a function whose first parameter is this type defined outside, but the programming language shoehornes me so much into classes and objects that I have to do all this extra ~bullshit~ boilerplate to have a function whose first parameter is this type defined outside".

Imagine having to create a monad, including the `pure` and `bind` operations every time you want to increment a variable. That would be bullshit, well, because it's bullshit. Even the haskell guys figured out it's bullshit and implemented types and operations (IORef) to simplify it.

C# hasn't figured out yet you should not have to wrap your function in a namespace and a class.

Re:Update to the .NET Language Strategy by hardware2win on Thursday February 09, 2023 @09:52AM (#34724782)
Weird definition since it misses the point.

Extension methods are: I want to add a new method(not function) to object which I dont have control of (in the code sense)

So I can call "externalObj.MyNewMethod()", so extend its behaviour

Re:Update to the .NET Language Strategy by javcasas on Thursday February 09, 2023 @12:08PM (#34727218)
Yep, a weird definition.

"I want to add a new not-a-method (because it can't access private stuff, unlike real methods) so that I can do "externalObj.MyNewMethod()" because doing "myNewOperation(externalObj)" is somehow forbidden."

Re:Update to the .NET Language Strategy by hardware2win on Thursday February 09, 2023 @12:18PM (#34727418)
Of course it cannot access internals because youd break "sane oop"
Re:Update to the .NET Language Strategy by iamthepieman on Thursday February 09, 2023 @08:29AM (#34723604)
Extensions are a horrible thing. But when you need em, man they are nice to have.
Re:Update to the .NET Language Strategy by booleandilemma on Wednesday February 08, 2023 @06:59PM (#34717611)
Your take is cold, or lukewarm at worst.

The language is getting complicated.

Re:Update to the .NET Language Strategy by jayd16 on Wednesday February 08, 2023 @07:16PM (#34717760)
So what's happening in swift or kotlin that's out of reach for C#?
Re:Update to the .NET Language Strategy by zengid on Wednesday February 08, 2023 @09:04PM (#34718819)
Everything they are doing in swift and Kotlin are within reach. Heck, those languages _copied_ a lot from C#, so it's the Original Gangster in terms of features. It's just that there's a lot of old baggage in there in terms of syntax and language defaults. Classes aren't sealed by default. Getting immutability requires lots of extra keywords, or you use `record`s, which are nice to use. I look at the new language features they're proposing, and it just feels like they are bending over backwards to add nice things because there's already so much there that they can't mess with. A clean slate would give them some freedom.
Re:Update to the .NET Language Strategy by cglong on Wednesday February 08, 2023 @07:54PM (#34718179)
Where does TypeScript fit into this? It's a wildly successful language from Microsoft that's also interpreted but doesn't use the CLR.

Disclaimer: I work at Microsoft, but not in the Developer Division.

Re:Update to the .NET Language Strategy by zengid on Wednesday February 08, 2023 @09:00PM (#34718780)
Great question because I think TypeScript is the future in terms of a web stack. With the 'metaframeworks' (not just the ones from Meta, winky face) all moving towards a Server Side Rendering paradigm, I feel like a full-stack TypeScript world just makes so much more sense in terms of developer productivity.

I also use TypeScript every day, and I absolutely love it. I feel like the power and flexibility of it's type-system are incredible tools for an industry programmer. I think TypeScript is going to get more mileage for me personally and I'll reach for things like C# less and less, because it feels like it's not keeping up with where the web industry is going. (Who knows, maybe they will dust off ASP.NET MVC and ditch Razor pages for some kind of .tsx like experience. A dev can dream..)

Re:Update to the .NET Language Strategy by CharlieDigital on Thursday February 09, 2023 @07:15AM (#34722820)
Start a petition for T#.

Merge C# and TypeScript.

I want my C# pattern matching in TypeScript and TypeScript's fluidity in C#.

Simplified initialization in C# without new(). Unless otherwise specified, use a default generic Dictionary<T,U> and infer the types for map initialization like:

    var x = { ["a"] = 1 };
Instead of:

    var x = new Dictionary<string,int> {...};
Then automatic type mapping and conversion utilities to objects:

    record class Rec(string a, int val);

    var k = x as (Rec)
(Yes, can already be done with implicit type conversion operators or writing utility classes, but making it more like TypeScript would just make it easier to adopt)
Re:Update to the .NET Language Strategy by zengid on Thursday February 09, 2023 @10:38AM (#34725519)
This is exactly what I dream of. Expressivity and flexibility of TypeScript, but with built in pattern matching.
Re:Update to the .NET Language Strategy by hoofedear on Thursday February 09, 2023 @07:05PM (#34733617)
Let’s get started then! I’m digging this T# idea
Re:Update to the .NET Language Strategy by pjmlp on Thursday February 09, 2023 @02:12AM (#34720683)
What spirit?

Kotlin only matters due to Google's shenanigans on Android with Android Java, and pushing Kotlin as its replacement.

It is J++ vs C# all over again.

They could just as well buy JetBrains.

Re:Update to the .NET Language Strategy by samtheprogram on Thursday February 09, 2023 @02:33AM (#34720830)
Cool idea: how about making a .NET/CLR backend for Kotlin?
Re:Update to the .NET Language Strategy by pjmlp on Thursday February 09, 2023 @02:46AM (#34720906)
It will be as successfull as IronPython, IronRuby, Clojure.CLR, Scala.NET,...
Re:Update to the .NET Language Strategy by zengid on Thursday February 09, 2023 @10:43AM (#34725585)
The spirit of starting over instead of cramming more into an old language, but making the new thing highly compatible with the old thing via transpilers or runtime sharing (Swift with Objective-C, Kotlin with Java).
Re:Update to the .NET Language Strategy by pjmlp on Thursday February 09, 2023 @12:27PM (#34727592)
Wrong analogy, Kotlin with Java is an Android thing, on the JVM there is no Kotlin whatsoever, only another guest language among so many others.

Maybe if JetBrains ever releases their own KVM, which by the looks of Kotlin/Native, is hardly something for the JVM ecosystem to worry about.

Re:Update to the .NET Language Strategy by bmitc on Thursday February 09, 2023 @02:44AM (#34720894)
There's no reason for such a language because I would argue that F# is superior to all of C#, Kotlin, and Swift, and it already exists.
Re:Update to the .NET Language Strategy by pharmakom on Thursday February 09, 2023 @03:39AM (#34721250)
F# is pretty much that language.
Re:Update to the .NET Language Strategy by hardware2win on Thursday February 09, 2023 @05:20AM (#34721946)
Fresh start would be more likely due to async vs green threads