5 ms·
Really excited for this proposal as it's been the main thing I have to apoligize for when extolling the values of C#. Outside of this it's hard to think of othe
by kkukshtel 2y ago
Really excited for this proposal as it's been the main thing I have to apoligize for when extolling the values of C#. Outside of this it's hard to think of other major features C# lacks for a language.
Additionally, excited to now watch this go in and people on HN still act like C# is the same it was 10 years ago.
- codr7 2y agoProper type aliases would be nice, but I have to say I really enjoy coding C# these days.
- neonsunset 2y agoWhy hello again :) I really appreciate your projects and noticed the web server one. There's an ask - please prefer built-in containers unless you have to use custom ones, at least for now. It is also not necessary to define aliases for types accessible directly: `using Namespace.AnotherNamespace` is enough to access them. There is no need to re-define the alias for `AnotherNamespace` if it matches either. When you have time, please look at sharpl PR which simplifies the implementation and makes it more compiler-friendly: https://github.com/codr7/sharpl/pull/2 https://github.com/codr7/sharpl/pull/2 In any case, welcome to C# and thanks!
- codr7 2y agoHello there :) Just a little bit of patience with the collections, I'm slowly learning to trust the native offerings, at least there's a regular List at the bottom now, much thanks to you. I'm just used to using more descriptive type names, that's all. It bothers me to no end when I have to keep guessing and memorizing the correct primitive type for a concept. Also makes the code more difficult to read. I'll have a look at the PR, thank you!
- kkukshtel 2y agoAlias-ing any type was added in C# 12 - do you mean something more than this? https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#alias-any-type https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs...
- neonsunset 2y agoIn this case aliasing refers to memory aliasing. As in, given a common struct that represents a type union, you can overlap the fields that satisfy 'unmanaged' constraint (think int, MyStruct(short, long), Guid) between each other, but you cannot overlap them with fields that are or contain object references, because this violates the spec and GC will likely crash upon encountering data that turns into garbage when interpreted as a pointer.
- kkukshtel 2y agoAn official proposal was just submitted for type unions: https://github.com/dotnet/csharplang/blob/18a527bcc1f0bdaf542d8b9a189c50068615b439/proposals/TypeUnions.md https://github.com/dotnet/csharplang/blob/18a527bcc1f0bdaf54...
- madeofpalk 2y ago> it's hard to think of other major features C# lacks for a language Heh yeah well, for better or worse, it seems to be C#’s design goal to have every single feature possible, with multiple variations of each of them. It means it’s able to cater to everyone and doesn’t turn people off the way strongly opinionated languages can. But it can make it a bit tricky to pick up.
- kkukshtel 2y ago> Every single feature possible, with multiple variations of each of them I'd really push back against this - where do you see API duplication? IMO the C# team is _incredibly_ conservative with new language features and only add in things that fit a missing part of the language, and when doing so try to also weave in existing C# features to build upon. I think if anything you may be referring to syntax options? There are a few syntactical ways to do the same things for sure, but I don't think that's bad, as each has their own use. But for bigger tentpole features like records or Span<T> or whatever, they are directly addressing a need and aren't just iterative versions of other things.