What To Look for in 2.0
Osborn: What else besides generics and anonymous methods should people be paying attention to in 2.0?
Hejlsberg: Nullable types, I would say, is a pretty important advance, too. Because it's one of the steps on the way to bringing parity between the database world and the general-purpose programming world. You know, it's very hard to talk about meaningful mappings between the two worlds when one world, the database world, is entirely based on nullable types, and the other world doesn't have them at all.
Hejlsberg: And of course, you can fake your way out of it--
Osborn: Which you have to do--
Hejlsberg: --in the general programming world, which, you know, people often do by boxing, for example, or by allocating an object in which they store the value, and then using
null if not. And that's effectively how Java does it. But it ends up being very expensive to do it that way. Because in order to represent an integer value that can possibly be null, typically the way it's done in Java is that you use the
Integer wrapping class, and you allocate instances for each
int value, and then you just use
null as the null.
Hejlsberg: But you quadruple the memory consumption for each
int, and you incur an indirection. So there's a lot of cost associated with that, where with nullable types in C#, we effectively give you the ability to make value types null, but we don't do it by allocating objects in the heap. We do it through a generic type that couples a
T and a
bool. It's called
Nullable<t>, and it has two fields inside of it, a
T and a
Nullable<T> is itself a value type. So it actually gets stack allocated or in-line allocated and ... it's much more efficient from a memory standpoint than other solutions that are out there. And over and above that, we have language syntax to support nullability. We have this question mark (
?) type modifier.
int is an integer,
int? is a
nullable integer, and there are implicit conversions from
int to nullable
int, and explicit conversion the other way that will throw a null exception if the thing is ... like all the things that you would naturally expect of a language that deeply supports nullable types as a proper concept. So again, it's this thing about giving first-class treatment to a thing that people use every day.
And again, for me, as a language designer, I look at, "What are people doing out there? And what is it that we need to think about giving first-class treatment to?"
Osborn: So is C# one language to rule them all?
Hejlsberg: [Laughs] No, no. I think not, I don't really think it is. There are lots of things for which other languages are more suited. C#, at its core, is a strongly typed language. And for certain things, you know, dynamically typed languages are more appropriate if you're just going to write a few lines of code, and you don't want to first have to do a bunch of declaring upfront. You just want to sort of try it out.
But within the family of languages that it's in, sure, I aim to take it as far as I can.
Osborn: In relation to 2.0, are the changes that we're seeing in the Microsoft implementation also being proposed as standards?
Hejlsberg: In 2.0?
Osborn: In 2.0.
Hejlsberg: Yes. The standard will be called "third edition", but it's actually the one that we're calling 2.0.
Osborn: So there's no aspect to it that's Microsoft only in terms of the changes.
Hejlsberg: No, every language feature in C# 2.0 has been submitted to ECMA and is in the standardization process. And we expect fairly shortly for the community to vote, and it's really a matter of procedure at this point [Ed.: This has already happened. See "C# and CLI Become More Powerful."]
Osborn: So probably by the end of the year?
This is part one of a two-part interview.
John Osborn is a senior editor with O'Reilly Media, Inc., responsible for Windows and .NET developer books, PDFs and other content.
Return to the ONDotnet.com.
- Trackback from http://www.ogadei.com/node/the-past-present-and-future-of-c/892
The Past, Present, and Future of C#
2005-11-01 13:29:39 [View]
- Trackback from http://lrlug.org/index.php?/archives/3-Newsletter-from-OReilly-UG-Program,-October-25.html
Newsletter from O'Reilly UG Program, October 25
2005-10-26 06:58:06 [View]
- Trackback from http://blogs.geekdojo.net/mitchell/archive/2005/10/24/9346.aspx
Anders Interview on C#
2005-10-24 07:33:08 [View]
- Trackback from http://franksworld.com/blog/archive/0001/01/01/1312.aspx
Interview with Anders Hejlsberg
2005-10-20 13:34:15 [View]
- Trackback from http://franksworld.com/blog/archive/2005/10/20/1312.aspx
Interview with Anders Hejlsberg
2005-10-20 13:31:45 [View]
Not so fast...
2005-10-18 18:55:48 xeal [View]
- Trackback from http://dotnetfan.org/blogs/dotnetfanblog/archive/2005/10/19/431.aspx
Anders Hejlsberg さんのインタビュー記事
2005-10-18 18:04:07 [View]
- Trackback from http://blogs.msdn.com/scottwil/archive/2005/10/18/482394.aspx
O'Reilly OnDotnet.com interveiw with Anders Hejlsberg
2005-10-18 13:49:56 [View]