Re: .NET generics & the .NET framework: not generic enough?
From: Daniel O'Connell [C# MVP] (onyxkirx_at_--NOSPAM--comcast.net)
Date: 07/18/04
- Next message: Ed_P.: "TreeView Question"
- Previous message: Daniel O'Connell [C# MVP]: "Re: foreach enhancement"
- In reply to: Jay B. Harlow [MVP - Outlook]: "Re: .NET generics & the .NET framework: not generic enough?"
- Next in thread: Jay B. Harlow [MVP - Outlook]: "Re: .NET generics & the .NET framework: not generic enough?"
- Reply: Jay B. Harlow [MVP - Outlook]: "Re: .NET generics & the .NET framework: not generic enough?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 18 Jul 2004 02:35:32 -0500
"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> wrote in message
news:%2349uNcIbEHA.2944@TK2MSFTNGP11.phx.gbl...
> Daniel,
> I gave the link more for an example of an existing suggestion, not as a
> suggestion I specifically endorse.
>
Sorry, I didn't mean to be harsh. I'm just rather annoyed with the operator
thing. I think I've posted that same general reply a dozen times now.
> I like IArithmetic<T>, as it seems to be the "easier" route. (the KISS
> principal). If only Int32 implemented it ;-) also IArithmetic<T> is in
> keeping with IComparable<T>.
Ya, that would help termendously by helping to constrain generics to
primatives alone. I do wish there was a way to express that you want int,
uint, byte, sbyte, short, ushort, long, ulong, string, decimal, double or
float *only* in a generic. It'd help out *alot* in data situations where you
want to create classes that handle simple data. But, alas, that is a pipe
dream right now. IArithmetic wouldn't help with everything, but it'd make
numbers simpler.
>
> I agree that an actual "operator +" constraint may need to get too fancy
> to
> be useful, especially when you consider it needs to work across languages.
> But then again Microsoft has a lot of talented people working for them,
> and
> if we (the users) keep throwing it about in the publics, hopefully
> something
> usable can be created...
>
Well, I for one am not a huge fan of operator overloading in general, but it
is frustrating not to be able to perform basic mathematics with generics. It
certainly takes away the ability to *easily* do something like the stream in
STL, where the size type could be defined in the template.
- Next message: Ed_P.: "TreeView Question"
- Previous message: Daniel O'Connell [C# MVP]: "Re: foreach enhancement"
- In reply to: Jay B. Harlow [MVP - Outlook]: "Re: .NET generics & the .NET framework: not generic enough?"
- Next in thread: Jay B. Harlow [MVP - Outlook]: "Re: .NET generics & the .NET framework: not generic enough?"
- Reply: Jay B. Harlow [MVP - Outlook]: "Re: .NET generics & the .NET framework: not generic enough?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|