Article about C# generics
Microsoft follow by SUN steps...
http://msdn.microsoft.com/msdnmag/issues/03/09/net/default.aspx
Please sign in to leave a comment.
Microsoft follow by SUN steps...
http://msdn.microsoft.com/msdnmag/issues/03/09/net/default.aspx
Please sign in to leave a comment.
If I am not mistaken Microsoft was first here.
You about STL? :)
"Dmitry Skavish" <skavish@intellij.com> wrote in message
news:bmmbjd$ocj$1@is.intellij.net...
>
>
yup...although not officially released Msft research had an implementation at the beginning of 2002 ...
http://jcp.org/aboutJava/communityprocess/review/jsr014/index.html
2001 ;)
"m.milicevic" <RE_THISjjooee@chello.nl> wrote in message
news:bmmciv$uub$1@is.intellij.net...
yup...although not officially released Msft research had an implementation
at the beginning of 2002 ...
First draft opened in March 1999
"Alexey Efimov" <aefimov@spklabs.com> wrote in message
news:bmmcm9$vd1$1@is.intellij.net...
>
>
>
>
>
yeah, sure, so it takes them about 5 years to implement it ;)
without joking,
I think we wouldn't see it even for little bit longer if msft didn't show up with c#...that was a wake up call for sun..
maybe :)
"m.milicevic" <RE_THISjjooee@chello.nl> wrote in message
news:bmmd8s$g5e$1@is.intellij.net...
yeah, sure, so it takes them about 5 years to implement it ;)
without joking,
I think we wouldn't see it even for little bit longer if msft didn't show up
with c#...that was a wake up call for sun..
m.milicevic wrote:
>>First draft opened in March 1999
sure generics in java had been investigated quite early, and GJ was put
to quite a bit of use. i believe the delay had more to do with
reluctance to make a major change to the language - AND the lack of
feature-one-up-manship from .NET.
these are not so new academic ideas. does it matter if microsoft was
talking about them first, if sun is the first to have them? regardless
of the history, if java has generics first, the impression is going to
be that C# copied one more thing from java.
as an aside, i think java has been able to foster quite a culture of
experimentation. AOJ, for example, is almost completely associated with
java.
sumit.
i meant AOP.
"Alexey Efimov" <aefimov@spklabs.com> wrote in message
news:bmmc2n$rov$1@is.intellij.net...
>
STL has absolutely nothing to do with Microsoft.
I know :)
"Michael Jouravlev" <mikus@mail.ru> wrote in message
news:bmmgfl$n19$1@is.intellij.net...
>
>
>
Well, generics in both Java and C# are an extremely cut down version of so
called System F<: (type system for lambda calculus(-based functional
languages), also called polymorphism with bounded quantification).
Credits for that mainly go to Luca Cardelli and Benjamin Pierce.
Friendly,
Dmitry
Alexey Efimov wrote:
>> http://jcp.org/aboutJava/communityprocess/review/jsr014/index.html
>>
>> 2001 ;)
>>
>> "m.milicevic" <RE_THISjjooee@chello.nl> wrote in message
>> news:bmmciv$uub$1@is.intellij.net...
>> > If I am not mistaken Microsoft was first here.
>>
>> yup...although not officially released Msft research had an
>> implementation at the beginning of 2002 ...
>>
>>
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
"System F<: (type system for lambda calculus(-based functional languages), also called polymorphism with bounded quantification)."
Wow, now THAT sounds great. I think I can impress my friends to drop-jaw tossing that sentence in the middle of a conversation :)
One point is not clear to me: do they support Generics for primitive types ?
Or is it just hidden by autoboxing ?
I would have liked to see primitives in Java's Generics ...
From what I understand, primitives in Java's generics is not possible. because that would require generating code like C++'s templates. If you use List and List]]> in your application, two separate classes are not generated like in C++. Instead, the same class is used, and the compiler inserts automatic casts when inserting and reading values into and out of the List. With generics, List still stores Objects, and an int isn't an object, so it will have to be wrapped by Integer like it does now. (But autoboxing will take care of this, I believe.)
i think there is meaningless which is first, sun or m$. they are all picking up the good nutrition from C++. IMHO, java has discarded too much good things, and they are picking up them now.
I don't think you can say that generics were taken from C+. Generics in Java are very different from generics in C, and in the papers I've seen describing how the generics semantics were decided and developed, C+ is either not mentioned at all or only mentioned as one of several "other languages with generic types."
Marcus Brito wrote:
For it to be more precise, you should also add "3rd order" :)
3rd order means that system includes type operators working on
ordinary types. For example List is a type operator (function from types to types). It will be fun to have higher order type operators - something like: class S> { T myF1 = new T(); T myF2 = new T(); } S> s1; S>]]> s2;
s1 will use an ArrayList for myF1 and myF2, while s2 will use LinkedList.
Friendly,
Dmitry
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
tc master wrote:
Can't call C++ templates a good nutrition. Remembering error messages that
you could get for extra comma in template makes me sick still...
BTW, templates in Java are, in a way, more powerful that those of C++.
In Java, you can have bounded type parameters for classes:
class S>]]> {
}
S says: "give me any C that is Comparable of itself".
You cannot have that in C++.
Friendly,
Dmitry
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
As far as I know from their papers and participating in MS Research
seminars, yes, they are going to support instantiations of generic types
with primitive type parameters. This would be achieved
by code specialization when type parameters have different machine
representation. Moreover, their ambitions also aim at providing exact type
information at runtime, i.e. in CLR 2.0 you will be able to write e.g.:
List l;
if (l instanceof ArrayList) ...
And get sensible result:)
However this obviously puts an additional overhead of maintaining complex
data structures by VM at runtime and I'm not sure the benefits (lack of
boxing for example) are worth it. Java-style generics implementation on the
other hand is more restrictive at runtime, but easier to implement.
Friendly,
Eugene.
"Peter Schäfer" <peter.schaefer@healy-hudson.com> wrote in message
news:19007660.1066656427091.JavaMail.itn@is.intellij.net...
>
?
>
Evgueny Vigdorchik wrote:
Apparently the point was:
List l;
....
if (l instanceof List]]>) {
....
}
Friendly,
Dmitry
>>
>> One point is not clear to me: do they support Generics for primitive
>> types
>> Or is it just hidden by autoboxing ?
>>
>> I would have liked to see primitives in Java's Generics ...
--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
Dmitry Lomov (JetBrains) wrote:
>>As far as I know from their papers and participating in MS Research
>>seminars, yes, they are going to support instantiations of generic types
>>with primitive type parameters. This would be achieved
>>by code specialization when type parameters have different machine
>>representation. Moreover, their ambitions also aim at providing exact type
>>information at runtime, i.e. in CLR 2.0 you will be able to write e.g.:
>> List l;
>> if (l instanceof ArrayList) ...
>>
>>And get sensible result:)
naive question - what will java generics do in the same situation? throw
(with what exception?)/ return false?
sumit.
I believe that code won't compile.
I think we can fairly say not only that C# learned a lot form Java, but that they both learned a lot from Lisp Eiffel Smalltalk and even (the accursed) Visual Basic.
Having reached mastery level of Java over the past fewe years, I love a lot of things about C# but hate a lot of things too.
What were they smoking, having no exception hierarchies, no base type hierarchies (e.g. no Number class), requiring a scope for namespace (package) and using clauses...
Frankly I cheer on both platforms that they might learn (steal) everything from one another: because of different drivers, cultures and goals each will add their own innovations anyway.
I think some of us (myself included, at times) need to see the platforms less like an artistic expression and more like swiss army knives or something; copying is acceptable and even encouraged, and let us developers be the winners!
No, the code will compile in Java, and will always return true, since for
underlying erasure types the condition is indeed true. Making the code
noncompilable
would be really a pain, so it is up to the programmer not to make such
tests.
"Keith Lea" <keith@cs.oswego.edu> wrote in message
news:9045331.1066679060688.JavaMail.itn@is.intellij.net...
I'm pretty sure it won't compile, or maybe it will output a warning.