Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> exists to only save a few keystrokes.

It does that, but it also makes your code read more like natural language. Perhaps I was careless in my wording, as I meant to point to manual, explicit configuration rather than fluent syntax per se.

As to your bullet points: I can see where you're coming from. I still think it's better than the invisible side effects and invisible method calls you get with annotations.

> What languages need is to bring back the "With" syntax that JavaScript and VB used to have

As far as I know, With... End With is a weird cross between "using" in C# and object initialisers. How does that help prevent mutations? One of the code examples (0) even explicitly mentions:

   With theCustomer
        .Name = "Coho Vineyard"
        .URL = "http://www.cohovineyard.com/"
        .City = "Redmond"
   End With
I honestly don't see the big difference with either:

   var customer = new Customer {
       Name = "Coho Vineyard",
       URL = "http://www.cohovineyard.com/",
       City = "Redmond"
   };
or:

   var customer = Customer
      .Name("Coho Vineyard")
      .URL("http://www.cohovineyard.com/")
      .City("Redmond")
      .Build();
[0] https://docs.microsoft.com/en-us/dotnet/visual-basic/languag...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: