'''Discussion of Microsoft's CsharpLanguage''' Here is the C# language tour from Microsoft: http://msdn.microsoft.com/library/en-us/cscon/html/vclrfGettingStarted_PG.asp ''For those who have downloaded and can read CLangref.doc, go to File|Properties and click on the Custom tab. Faaaascinating'' -- StevenNewton ---- Is it appropriate to delete the old commentary? C# has been in the public's hands for over a year now, and the prognosticative comments below about how C# "will be" seem irrelevant to the present. (But I don't want to delete anything that others find valuable.) -- KrisJohnson ---- I loved this quote from the end of the article: "Yesterday, Microsoft executives denied that C# was related to the rumored Cool project." Yeah, sure, I believe that. -- CurtisBartley I cannot understand why Microsoft feels the need to lie so vigorously about this. I saw a C# demo by someone who had been involved with C# from the early days. He accidentally displayed a directory path which showed that his examples were under a ".../cool/..." path. He said "Oops, you weren't supposed to see that, but I guess it doesn't matter now that C# is announced." There is an article at the Register which lists dozens of references to "Cool" that occur in the C# documentation, examples, etc: * http://www.theregister.co.uk/content/archive/13175.html And yet the Microsoft spin-doctors still insist that the projects are unrelated. Why? -- RogerBrowne ---- I should hope not. I would pronounce it C-hash. "Hash" variously means a jumble, a mess; reused or recycled material. (It is also an abbreviation for a mind-altering drug.) -- DaveHarris ''It's not C-hash, it's C-sharp (like in music notation, the tone halfway between the C and the D). So the sharp suggests that it is slightly higher ("better") than C.'' Isn't Csharp in the music world also known as Dflat Major? ''Only in equal temperament.'' Sharps and flats don't make much sense anywhere else. C-sharp and D-flat are synonyms, D-flat major is the scale based thereupon, and C-C#-C-C# is very ominous theme music. ''What do you mean by "don't make much sense anywhere else"? Composers were writing music with sharps and flats long before equal temperament was used.'' I was under the distinct impression that it was intended to be four little plusses; meaning it is (C++)++. Stacking them makes a convenient musical symbol. -- EwanHiggs ''"C++" is not an lvalue.'' ''(Warning! Severe sarcasm ahead ... damn, too late!)'' Also, I wonder if CommonLanguageRuntime is IntentionalProgramming with another name? -- ShaeErisson From the now-defunct Dflat''''''Language: : A language born of an Anti Trust lawsuit. Also known as CsharpLanguage. It's the JavaLanguage you have when you want to be incompatible with Java. ---- For all what's it worth, I think the world could use a new C++/Java spin-off. IMHO, such a language should have the following features: * Simplified version of C++ syntax (a la Java) * Modula 2 -like module system (rather than include file tricks) * ML-like generosity ''do you mean genericity?'' (rather than C++'s complicated templates ''I think CL macros are a better replacement for C++ templates'') * garbage collection * lexical closures * program self-knowledge (a.k.a. reflexion) * no political bias against compilation to native code None of these features are particularly new, but if properly marketed, perhaps some of them would finally make it into the RealWorld. -- StephanHouben ''Generics support in C# has been developed in a research version of the compiler, and will be officially supported in a future release. More info on Generic C# here:'' http://research.microsoft.com/projects/clrgen/generics.pdf ''Delegate-style inheritance?'' Also cool, but I was attempting to follow the "extremely conservative" school of language design. The features listed are what I consider the absolute must-haves. Remember, this language is supposed to appeal to people who consider C++ and Java the sum of language design... ''If JavaScript dared to...'' ---- I would assume that the runtime is the "UniversalVirtualMachine" which was originally supposed to be in ComPlus. -- CurtisBartley Whatcha talkin' 'bout fellas? I saw sneaky references to things like "attribute information for a given program element can be retrieved at run-time by using the .NET runtime's reflection support." Does this mean the language is inextricably linked to a Virtual Machine that supports the COM+ spec (and in turn its Type Library mechansim)? Spill the beans! :-) -- DanGreen : ''C# requires a runtime, including the Type Library system; The runtime need not support the COM+ spec, but it may. -- DinoChiesa, 9 May 2001'' ---- * Inside a specially marked code block, developers are allowed to use pointers and traditional C/C++ features such as manually managed memory and pointer arithmetic (these blocks are called ''unsafe'') ''[This language feature is taken from ModulaThree. If only the designers of Java had taken more ideas from this excellent language. Hopefully C# uses Modula's model of pointers and addresses, instead of C's confused and confusing model.]'' ---- I could call it Java with enums, unsigned types, preprocessor and operator overloading. But really it's more like C++ with some syntactic tweaks. Symantically there are no primitive types. There's some odd things like decimal which is 28 bits but not rounded. It has sealed classes, which are equivalent to Java final. It has goto, exceptions. It has typeof and sizeof, and you can still do direct pointer manipulation in code marked with the keyword 'unsafe'. It has automatic memory management by default, though. I don't see any mention of templates or generics. OK, my verdict is that it's C++ COM components dressed up to look and act like Java as much as possible. Oh but the compiler generates .exe files. No very cross-platform, unless and until someone ships a compiler for other systems, but it looks to be tied up with COM pretty tightly. : ''In the .NET beta, there is a csc.exe compiler that generates MSIL. The MSIL is then hosted within the runtime, which today, is available only on Microsoft platforms as an Exe. -- DinoChiesa, 9 May 2001'' ''Minor annoyance: I can do a search for C++ on the major search engines. I can search for Java. How to I search for C#? That octothorpe/pound sign/number sign/key signature thingy doesn't compute.'' -- StevenNewton ---- OK, my verdict is that it's C++ COM components dressed up to look and act like Java as much as possible. This all sounds pretty interesting. Apparently it ''does'' support run-time loading of compiled modules, ''and'' compilation to native code, ''and'' garbage collection. Now if it also supports operator overloading, it might be a good alternative to C++ for writing numerical stuff. That is, provided that MS also produces a Linux version. -- StephanHouben Operator overloading is in there. -- DrewMarsh Microsoft produced a FreeBSD version called Rotor. See SharedSourceCli. ---- How long before it's supported by GCC? ''GCC's intermediate representation is rather hostile to bytecode generation, I believe (too much type information is thrown away too early to make writing a backend that emits IL feasible, iirc), although a front-end that compiles C# to native code would be feasible, if someone wanted to make the effort.'' Microsoft have submitted C# to ECMA for possible (eventual?) standardisation. It has been submitted! Ah, the irony, as last week, Sun declared victory with Java and they still haven't tuned it over. As reported earlier, Microsoft has proposed its new language, called C# (pronounced "see sharp") to an industry standards body called ECMA. As first reported by CNET News.com, with C#, Microsoft aims to make it easier and faster for software developers to build Web-based services and is part of the company's new software strategy, announced last week.Microsoft is hoping to spread C# usage throughout the industry by enticing other technology vendors to create versions of C# that will run on multiple operating systems and hardware. "We're working with ECMA, so there will be a wide range of devices and platforms that will have C# available for them," said Tony Goodhew, Microsoft's Visual C++ product manager. "We see this as a great value in language standards, as a standard language for people to actually go and produce the interconnected applications utilizing XML and Web services and so on. There's really no language that provides that ability." Sun had hoped to turn Java over to the same standards body but withdrew its proposal last year on fears that it would lose control of Java's evolution. Java proponents argued that making Java an industry standard would give other companies a much stronger position in defining Java and determining the direction of the software. But Sun executives implied that standardizing through ECMA could result in a version of Java that worked differently from Sun's. Sun has long criticized Microsoft for protecting the proprietary interfaces of its technology. Now, Microsoft will attempt to take the high road, analysts said. "(Submitting C# to ECMA) is not intended to needle Sun, but it does have that side effect," said Darryl Plummer, an analyst at Gartner Group. "It sort of says, 'Unlike Sun, we're going to play fair and send it to a standards community.'" See http://dailynews.yahoo.com/h/cn/20000626/tc/microsoft_strikes_at_sun_s_java_with_new_standard_2.html (deadlink) Sun blows it again. It's not that Microsoft is so great technically. They are so great at capitalizing on the mistakes of their competitors. -- AnonymousCoward Actually standards bodies like ECMA aren't the voice of democracy that some would have us believe. C# was submitted to ECMA because Microsoft and IBM can pretty much control the standardization process by working together. Java was not submitted to ECMA for exactly the same reason. Sun isn't afraid of letting Java be controlled by the community - take a look at their community process - no, Sun is afraid of having Java controlled by the likes of Microsoft and IBM. If you read the C sharp documentation you'll see that it is intimately tied to the COM architecture, indeed that is one of its main strengths. There is nothing cross-platform or open about this language, standardization not withstanding. ''I have a question about CompaniesControllingLanguage. -- JohnPassaniti'' ---- Hmm...the Versioning section on the Spec is empty but at least there's mention of it in the Introduction. Good stuff. Last time I checked Java and EnterpriseJavaBeans completely ignored this very important area. -- DanGreen Java supports versioning of packages. You can use dynamic class loading to load specific versions of packages, or query the current version of a loaded package through reflection. ''Well, did that sneak by me whilst on a rather punishing Java-free sabbatical? Which version introduced such a concept? How's it controlled?'' -- DanGreen Java has always had rules that specify how changes to a class maintain or break binary compatibility with pre-existing clients. Similarly, it's always been possible to use dynamic class loading to load specific versions of a package. Java 1.2 (or perhaps 1.3) added classes and methods to the Reflection API for querying package versions. : ''Gimme a break, this versioning is half-baked an unsupported. Ever look at the various classes that are delivered with JDK1.3 or JSDK or JAXP or .... Virtually ''none'' of them have version information attached. Furthermore, packages are not delivered as unified entities. So with a little classpath magic, I can replace classes X and Y from myPackage, while leaving class Z alone. The versioning supported by Java is just insufficient. -- DinoChiesa, 9 May 2001'' ---- I'm interested in how MicroSoft are going to position CeeSharp against VbDotNet. What are the timeframes on both languages? Releasing both with VisualStudioSeven seems an interesting marketing choice. Are they risking confusing EnterpriseCustomers even more? -- DanGreen I guess Enterprise Customers will go with what they are used to. Visual Basic programmers will stick with VB, while C++ programmers will move to C# because of the productivity improvements compared to C/C++, and additional safety it ensures for programs used in a hostile network. (I'm assuming improved productivity because that's what I found when switching from C++ to Java). C++ programmers may worry about moving to a non-standard language. However, Microsoft's C++ has fallen behind the standard, has bugs in its implementation of some advanced standard features, and uses non-standard extensions for programming to the Windows API and writing COM components. Thus C++ programmers have nothing to lose by switching to C#, and a lot to gain. -- NatPryce ''Which may explain just why Microsoft's C++ has those failings... -- GarethMcCaughan'' ---- Let's not forget Kent's fab quote from ExtremeProgrammingWithTypes: ''"The problem with types is that they force you to say things that you don't know are true, just to get the compiler to bless your program. "Here is the interface between these two objects" is a good example of the kind of thing you are forced to say before you know it's true. The interface between two objects invariably changes. I like not having to specify it when it is sure to change. Instead, I can say "This object needs an object like that in order to work". I know this is true (for now) because the code demands it. When the code changes and the interface changes, I change the code (which I know needs to change), but I don't have to change anything else."'' -- DanGreen ''Yes! But who is going to design the language and environment for XP from the ground up that isn't Smalltalk? (Because let face it, it's pretty unlikely that those raised on C/C++ will endure the "told you so".) See NewLanguagesForXp.'' ---- Here's an interesting excerpt from Microsoft's introduction to C#, emphasis mine: : For C# developers, this means that even though C# is a new language, it has complete access to the same rich class libraries that are used by seasoned tools such as Visual Basic and Visual C++. ''C# itself does not include a class library''. Microsoft is submitting C# to ECMA, but I'm curious as to whether they are planning to submit any of the aforementioned class libraries to ECMA. This is an important distinction, because Microsoft is fully aware that languages don't lock one into a particular platform so much as APIs do. -- CurtisBartley See DotNetEcmaProcess. ---- No mention of parameterized types anywhere. It seems like every C++ expert is doing nifty template stuff these days, why was it left out of C#? Is it too hard to add parametrized types to Java-like languages? -- AndrewQueisser ''Absolutely not, see ModulaThree.'' This is particular strange, since Microsoft Research employs LucaCardelli, who (as one of the designers of Modula-3) should know quite a lot about polymorphism in OOP languages. See http://research.microsoft.com/Users/luca/ I have the distinct impression that none of these highbrow researchers at Microsoft was consulted in the design of C#. -- StephanHouben Hm, that sounds pretty unlikely. Especially considering this interview with AndersHejlsberg: http://windows.oreilly.com/news/hejlsberg_0800.html, wherein he talks about generics and templates, the work that's being done, the goals for the future of .NET, and the role of Microsoft Research in the process. Hmph. -- DinoChiesa ---- When Sun brought Java into the world, they had a complete specification, a reference implementation that ran on multiple platforms, a cross-platform set of libraries including a GUI system. Oh and it could be downloaded for free. That's a pretty decent accomplishment right there. For C# we have... an incomplete specification and a bunch of NDA-limited hints. If this we're a CS class that wouldn't get a passing grade. I'm betting - here in writing - that when C# is released it will only run on Microsoft platforms, will be dependent on COM for library functionality and GUI implementation. -- StevenNewton ''No, there is 0% dependency on COM. All of DotNet is based on things like XML and SOAP.'' I'm betting - here in writing - that when C# is released it will only run on Microsoft platforms, will be dependent on COM for library functionality and GUI implementation. -- StevenNewton ---- Some say C# is largely about making it as easy to build COM objects as it is to build JavaBeans. Therefore, it doesn't appear that C# has any reason to take mindshare away from Java. From what I can tell, they don't solve similar problems. One might suspect, the only way in which they really compete is in the minds of the media. I may be wrong. The more I study it and the more I read things like the above, it seems like it's being positioned as a cross-platform language for building Internet services. "Microsoft .NET building block services can be consumed on any platform that supports SOAP." ''I think the key word here is "consumed". Other platforms will be able to "consume" the data provided by "providers" (aka WebService''s'') written on the MicroSoft platform. The consumers and providers will communicate using the SimpleObjectAccessProtocol, which is becoming available in just about every language, most importantly for this scenario (i.e. cross-platform interop) is Java. So C# is just another language for writing a provider on the MicroSoft platform. More specifically, C# is just another language for writing COM components which are easily exposes as WebService'''s'''.'' -- DrewMarsh ---- If Sun were to now add COM capability to Java, they might be able to counteract the rush to C#. It would make sense to companies, at least for a while, to continue using Java given all the available tools, libraries, and people that are currently available. Companies would also continue using Java because they could switch between Corba and COM as convenient. As MS adds features to C#, Sun has to keep adding them (assuming the features could cause someone to switch). MS does all of the R&D and marketing work and Sun just does the 'simpler' work of adding the feature to Java. The only impact that MS would feel is they have put in the development money and will be unable to sell C#. Just a thought, -- John Arrizza Take a look at: http://developer.java.sun.com/developer/earlyAccess/j2eecas/. ---- As for ECMA, Microsoft is behind the curve. SUN already submitted Java. The only question is when will Microsoft withdraw C#. -- ThaddeusOlczyk Sun withdrew Java again. C# is still in the process. ---- > Take a look at: http://developer.java.sun.com/developer/earlyAccess/j2eecas/. Cool. Is this what MS was pitching to Sun earlier? Or was there more to it? ''No. According to what Thomas Ball (tball@best.com) said on the ExtremeProgramming email list what Microsoft offered was: "Without a reference implementation (source wasn't forthcoming), and with the requirement that their native method invocation be used unaltered. The latter would have prevented the complete, fast GC that VMs like HotSpot have." Thomas claims to have been the lead Win32 engineer at J''''''avaSoft when all of this was happening.'' Further along to this line of reasoning: why doesn't the C++ standards committee add a "C++ standard library" as comprehensive as MFC, Java's and smalltalk's standard libraries? If they did, some of the impetus to move to Java or Csharp or whatever would not be there. Java would have to add even more goodies to it and so on. Guess who wins? We do. I believe in competition I guess. I would like to see a large increase in the competition between C++ vs Java and between Java and VB. I think that the software world would be a much better place if MS was not the majority holder of the de facto language(s) currently in vogue. I don't want another language out there. Especially if it just like one already out there already. What a huge waste of time and effort! I can see the head hunters now: "Do you know C#?" "No, I know Java." "Too bad, if you knew C#, I'd place you in an opportunity in Iowa for $300K a year." -- John Arrizza Very well said. The key thing about "mainstream" development prior to Java was that the two languages increasingly used for new commercial projects, VB and C++, were effectively controlled by Microsoft. In the one case through owning the whole shebang, in the other through increasing control of the de facto standards for libraries and programming environment, closely linked to the emerging Windows "monopoly". Like you, I very much believe in the benefits of competition in these areas. As we've said before (FutureOfJava) the Web at least provides some much needed impetus towards increased competition. -- RichardDrake ---- ''What makes the CsharpLanguage a C/C++ hybrid? IMHO it is a step further away from C, relative to C++, not closer to it. Have I missed something?'' Depends on where you see Java. Java may be seen as a C/C++ hybrid with a small and simple language kernel (like C) and solving problems C++ didn't solve (e.g. GC). Now C# is still a bit nearer to C (pointers, goto) and solves some of the Java problems. So if one likes to avoid the word Java, why not call it a C/C++ hybrid? ''C++ has no problems with GC. There are many (over 10) different GCs for C++, all of them very good... The committee just failed to include that sentence in the standard text... Check, http://www.research.att.com/~bs/bs_faq.html#garbage-collection '' ''When I hear C/C++ hybrid, I think "a hybrid between C and C++". But it seems like it should be read as "a hybrid language based upon C/C++", correct?'' I think the C/C++ comparison was just a poorly thought out statement. Just evaluate C# as its own language and stay away from language wars with C/C++. That just distracts from the evaluation. ---- See http://www.research.att.com/~bs/bs_faq.html#Csharp for BjarneStroustrup's view of C#. Note that he's not exactly a Java fan, either. Of course, he ''is'' the designer of C++... -- GeorgePaci As you said in the JavaLanguage topic, thanks for the useless quote. So? He never did understand components. ---- ''[Later...]'' Amazing how much of this page turned out to be absolute BS... DotNet was released late January 2002, the Mono project released a freely available GPL C# compiler, ECMA approved the C# and CLI standards, and HP and Intel are backing Ximian's efforts to create a DotNet CLR for Linux. The forces supporting C# (and DotNet) are much greater than those that oppose. ---- AndersHejlsberg recently announced some new features for C# V2, including GenericType'''''s (with constraints), anonymous methods (cleaner delegates), new iteration syntax (no more GetEnumerator()!) and partial types (ability to split a class across more than one file). ---- I'm confused with DelegateQuestion. This doesn't seem to allow subtypes to be used with delegates. Am I missing a keyword? ---- Can someone knowledgeable please offer information about CsharpClosures? ---- From my brief experience with CSharp, until v2.0 comes out officially, they are sorely missed. For example, if you want to asynchronously add an object to a List''''''Box control, the least way I could come up with was: private delegate void AddToListBoxD''''''elegate(List''''''Box listBox, object newItem); private void AddToListB''''''ox(List''''''Box listBox, object newItem) { listBox.Items.Add(newItem); } private AddToListBoxD''''''elegate addToListBox = new AddToListBoxD''''''elegate(AddToListB''''''ox); private void AsyncAddToListB''''''ox(List''''''Box listBox, object newItem) { listBox.Invoke(addToListBox, new object[] {listBox, newItem}; } Notice the same method signature four times over. Surely delegates have some nifty features like composition and you can reuse them after declaring them once, but for cripes sake this could have been done easier. Like the compiler automatically generating compatible delegates when a method reference is used. Even AnonymousInnerClass''''''es are more legible when simple GUI hacking is asked for. DotNet has a few cases of using delegates where they aren't too useful, and not using them where they would be - like data binding the interface to model elements. I haven't looked at that one too deeply, since it frankly scares the heck out of me, but it's apparently only possible to bind structured controls directly to collections. Yay, explicitly synchronizing a presenter collection with the model, or keeping application data in one place with its formatted representation. Compare to JavaSwt/JFace, which uses proxy classes that first extract data to be displayed from the model, then create its applicable selection - seems much more flexible, customizable, and reusable to me. ''The blame falls squarely on winforms for that one - not C#. The winforms design is generally acknowledged by everyone (including Microsoft employees) as a low-quality get-it-out-the-door framework. Avalon should be significantly better. -- MichaelSparks'' ---- CategoryCeeSharp CategoryDotNet