3 ms·
> you end up having to name things that don't really need names. Strictly speaking namespaces don’t need names, either. But for medium to large projects they’r
by Const-me 7y ago
> you end up having to name things that don't really need names.
Strictly speaking namespaces don’t need names, either. But for medium to large projects they’re still useful, and enforced by the IDE.
> to imagine functions living in just a namespace, not a class.
You can place them into a namespace on the consumer side of the API, with `using static`. While not the same, might be good enough in practice: you normally have multiple `using` statements on top, for namespaces.
> I'd be interested in seeing the model reversed, e.g. immutable defaults with something like `public mutable class Foo`
I wouldn’t want immutable defaults, but I do want readonly classes and structures, with readonly being part of the type system.
BTW, the new value tuples with named fields is a step in the right direction https://blogs.msdn.microsoft.com/mazhou/2017/05/26/c-7-series-part-1-value-tuples/ https://blogs.msdn.microsoft.com/mazhou/2017/05/26/c-7-serie... Useful but limited, I would prefer real immutable classes & structures. Currently I have to create them manually, mark all fields public readonly, implement the constructor, that’s more typing than I’d like.