3 ms·
Proper type aliases would be nice, but I have to say I really enjoy coding C# these days.
by codr7 2y ago
Proper 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...