Namespace Generics #1359
Replies: 10 comments
-
What makes this better than the approach you're currently using with a container class? |
Beta Was this translation helpful? Give feedback.
-
My classes are contained in an actual namespace instead of inside another
class.
Always glad to help,
[image: AlphaDrive for Clio] <https://www.alphadriveforclio.com/>
Tony Valenti
Software Engineer
T: 402-401-7568
E: [email protected]
W: www.AlphaDriveForClio.com <https://www.alphadriveforclio.com/>
Schedule a Meeting with Me
<https://www.alphadriveforclio.com/schedule-meeting>
This message contains confidential information and is intended only for the
intended recipients. If you are not an intended recipient you should not
disseminate, distribute or copy this e-mail. Please notify us immediately
by e-mail if you have received this e-mail by mistake and delete this
e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. Therefore we do
not accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission. If verification is
required please request a hard-copy version.
…On Tue, Mar 6, 2018 at 5:48 AM, Petr Onderka ***@***.***> wrote:
What makes this better than the approach you're currently using with a
container class?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/dotnet/csharplang/issues/1359#issuecomment-370756529>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM-qVlxTwvFX1C12mP3JaDtjZl7RMDfwks5tbnd3gaJpZM4SeiTd>
.
|
Beta Was this translation helpful? Give feedback.
-
@TonyValenti Yikes, your email footer defies GitHub's algorithm. |
Beta Was this translation helpful? Give feedback.
-
@TonyValenti I think what @srivatsn meant was you can currently use a nested class solution instead. |
Beta Was this translation helpful? Give feedback.
-
Yep and surely what @TonyValenti is saying is that having to use the nested class solution feels like a hack, so could we have a proper solution please? |
Beta Was this translation helpful? Give feedback.
-
@DavidArno I'm still trying to understand the usage of it. Do you have any sample? |
Beta Was this translation helpful? Give feedback.
-
@stevenxi I think the point is, class is class and namespace is namespace. Now we need to use class as a namespace just for making generic. It also cannot use normal As for me I prefer that we should have everything as class and nested class instead of namespace. But the way of thinking it cleanly separate is understandable |
Beta Was this translation helpful? Give feedback.
-
Well, this look good at first glance. But I think it would be conflict with many things when it was used in more complex situation How would we use |
Beta Was this translation helpful? Give feedback.
-
I can't foresee enough use cases off the top of my head to make this worth a language feature. It seems like the real "burden" here is typing the constraints again, rather than the names. Given that the majority of end-users of C# are not, for either lack of education or lack of need or both, specifying generic type constraints (from my experience), and far fewer still are creating multiple types with the same constraints that can't be satisfied by methods on a single class in such a way that they are burdened by having to repeat them, I can't imagine this being useful beyond a very small percentage of users and further still beyond a very small percentage of those users' codebases. I'd encourage you to provide some use cases of functionality that this would unlock that would be beneficial to more people. |
Beta Was this translation helpful? Give feedback.
-
To me, I think it's a bit weird of an idea. But using a generic partial container class gets the job done, right? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
When working with heavily-generic code, I often find that I'm typing generic argument names and constraints over and over and over. To get around this, I often put classes inside a generic container class that way I can avoid having to type them all over. It would be really nice if I could just have a generic namespace or generic typedefs so they could be reused.
Something like:
which would transform into:
Beta Was this translation helpful? Give feedback.
All reactions