logoalt Hacker News

za3farantoday at 3:51 AM1 replyview on HN

> Proper IEnumerable with proper iterators that in turn enables Linq

Are you referring to generators?

> Properties

As far as I'm aware, it is a deliberate choice not to implement them, and I can see their point of view.

> object initialisers

I believe the same justification applies here, it's mainly syntactic sugar, and can result in certain undesired behavior by bypassing constructors where validation can happen.

> extension methods

Typeclasses are currently being explored, which are a superior approach.

> named and optional arguments in functions

Those would be nice (at least named arguments). I can see how optional arguments could complicate things.

> generics over primitive types

As you mentioned, it's in the works

> async/await... verbiage could still probably be hidden behind a friendlier syntax

The approach they took does not need any extra syntax.


Replies

troupotoday at 6:39 AM

> Are you referring to generators?

Both I guess.

Main thing is https://learn.microsoft.com/en-us/dotnet/api/system.collecti... which seems to be everywhere in the language and the library.

> I believe the same justification applies here, it's mainly syntactic sugar, and can result in certain undesired behavior by bypassing constructors where validation can happen.

This is mostly due language design. Java heavily relies on properties and provides no facilities for them. Hence the builder pattern instead of object initializers.

In C# object initializers synergize with properties: https://learn.microsoft.com/en-us/dotnet/csharp/programming-...

> The approach they took does not need any extra syntax.

You mean it needs 15 lines whete C# needs one? ;)