this post was submitted on 20 Oct 2023
38 points (93.2% liked)

Programming

17325 readers
218 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Corngood@lemmy.ml 3 points 1 year ago (6 children)

I'm sure a lot of work went into this, but it seems crazy that we need another way to initialise collections, and another way to make fixed sized arrays.

I just want less boilerplate.

[–] Lucky@programming.dev 2 points 1 year ago (3 children)

The new list initializing syntax is less boilerplate, no?

[–] Corngood@lemmy.ml 1 points 1 year ago (2 children)

Look how clunky it is to add support on a collection. Take the example here:

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/collection-expressions#collection-builder

It involves adding a new builder class, and they actually have to reference the function by string name.

It's actually making me even more angry now that I look at it in detail.

[–] Lucky@programming.dev 1 points 1 year ago

This is for custom collections, right? And you don't even have to use it, you can keep using existing ctors for your custom collections

Worse case scenario you keep doing what we've always had to do. But for the 99% of use cases we get a much more streamlined initializer, with extensions to use our own.

I don't see how that's a bad thing

load more comments (1 replies)
load more comments (1 replies)
load more comments (3 replies)