Re:Milestone: Half a million downloads for VideoLAN packages...
by jayd16 on Wednesday January 13, 2021 @11:47AM
(#25764551)
You could use an explicit private readonly field and a property getter, or even just a public readonly field. I would argue its only sugar.
[ Parent
| on HN ]
Re:Milestone: Half a million downloads for VideoLAN packages...
by 9wzYQbTYsAIc on Wednesday January 13, 2021 @04:12PM
(#25768029)
Are you referring to the init only setters?
If so, it isn’t just sugar, they added a new hook for it in the internals, rather than just relabelling a technique to accomplish a similar (but not equal) end.
Re:Milestone: Half a million downloads for VideoLAN packages...
by ygra on Wednesday January 13, 2021 @03:45PM
(#25767730)
It doesn't scale that well, as you need ctor parameters for every property, so API additions may also be breaking changes.
Re:Milestone: Half a million downloads for VideoLAN packages...
by merb on Saturday January 16, 2021 @04:04PM
(#25805491)
well that would be different to instantiate tough.
it would be Class(1, 2, 3) instead of
Class {
Value1=1,
Value2=2,
Value3=3,
}
actually record types are more syntactic sugar around what you said than initonly, which opens up a new way of writing code